//! 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,
};
/** 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.

 **[Account](http://hl7.org/fhir/StructureDefinition/Account) v5.0.0**

 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>);
/** 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.

 **[Account](http://hl7.org/fhir/StructureDefinition/Account) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.  Might or might 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 | on-hold | unknown**

 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(rename = "status")]
    pub status: 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>,
    /** **[AccountBillingStatus](http://hl7.org/fhir/ValueSet/account-billing-status); Tracks the lifecycle of the account through the billing process**

 The BillingStatus tracks the lifecycle of the account through the billing process. It indicates how transactions are treated when they are allocated to the account.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "billingStatus")]
    pub billing_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_billingStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub billing_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>,
    /** **The entity that caused the expenses**

 Identifies the entity which incurs the expenses. While the immediate recipients of services or goods might be entities related to the subject, the expenses were ultimately incurred by the subject of the Account.

 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 might not be allocated. */
    #[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>>,
    /** **Transaction window**

 The date range of services associated with this account.

 It is possible for transactions to be posted outside the service period, as long as the service was provided within the defined service period. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "servicePeriod")]
    pub service_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_servicePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_period_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 jurisdictional 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/jurisdictional 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>>,
    /** **Entity managing the Account**

 Indicates the service area, hospital, department, etc. with responsibility for managing 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>,
    /** **The parties ultimately responsible for balancing the Account**

 The parties responsible for balancing the account if other payment options fall short.

 */
    #[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>>,
    /** **The list of diagnoses relevant to this account**

 When using an account for billing a specific Encounter the set of diagnoses that are relevant for billing are stored here on the account where they are able to be sequenced appropriately prior to processing to produce claim(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosis")]
    pub diagnosis: Vec<Option<AccountDiagnosis>>,
    /// 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 list of procedures relevant to this account**

 When using an account for billing a specific Encounter the set of procedures that are relevant for billing are stored here on the account where they are able to be sequenced appropriately prior to processing to produce claim(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Vec<Option<AccountProcedure>>,
    /// 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>>,
    /** **Other associated accounts related to this account**

 Other associated accounts related to this account.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedAccount")]
    pub related_account: Vec<Option<AccountRelatedAccount>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedAccount")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_account_ext: Vec<Option<FieldExtension>>,
    /** **[AccountCurrency](http://hl7.org/fhir/ValueSet/currencies); The base or default currency**

 The default currency for the account.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "currency")]
    pub currency: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_currency")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub currency_ext: Option<FieldExtension>,
    /** **Calculated account balance(s)**

 The calculated account balances - these are calculated and processed by the finance system.

The balances with a `term` that is not current are usually generated/updated by an invoicing or similar process.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "balance")]
    pub balance: Vec<Option<AccountBalance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_balance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub balance_ext: Vec<Option<FieldExtension>>,
    /** **Time the balance amount was calculated**

 Time the balance amount was calculated.

 The total(s) are not typically updated using the restful API but more often by back-end processes included in a typical finance system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "calculatedAt")]
    pub calculated_at: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_calculatedAt")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub calculated_at_ext: 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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), such as insurances, that may contribute to the payment of this account**

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

A coverage may only be responsible 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Guarantee 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()
    }
}
/// Sub-fields of the diagnosis 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 = "AccountDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountDiagnosis {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Ranking of the diagnosis (for each type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequence")]
    pub sequence: Option<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>,
    /** **[condition-code](http://hl7.org/fhir/ValueSet/condition-code); The diagnosis relevant to the account**

 The diagnosis relevant to the account.

 */
    #[serde(rename = "condition")]
    pub condition: CodeableReference,
    /// 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>,
    /** **Date of the diagnosis (when coded diagnosis)**

 Ranking of the diagnosis (for each type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateOfDiagnosis")]
    pub date_of_diagnosis: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateOfDiagnosis")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_of_diagnosis_ext: Option<FieldExtension>,
    /** **[DiagnosisUse](http://hl7.org/fhir/ValueSet/encounter-diagnosis-use); Type that this diagnosis has relevant to the account (e.g. admission, billing, discharge …)**

 Type that this diagnosis has relevant to the account (e.g. admission, billing, discharge …).

 */
    #[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>>,
    /** **Diagnosis present on Admission**

 Was the Diagnosis present on Admission in the related Encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onAdmission")]
    pub on_admission: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onAdmission")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_admission_ext: Option<FieldExtension>,
    /** **[diagnosis-package-code](); Package Code specific for billing**

 The package code can be used to group diagnoses that may be priced or delivered as a single product. Such as DRGs.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageCode")]
    pub package_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packageCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub package_code_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AccountDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountDiagnosisBuilder {
        AccountDiagnosisBuilder::default()
    }
}
/// Sub-fields of the procedure 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 = "AccountProcedureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountProcedure {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Ranking of the procedure (for each type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequence")]
    pub sequence: Option<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>,
    /** **[](http://hl7.org/fhir/ValueSet/procedure-code); The procedure relevant to the account**

 The procedure relevant to the account.

 */
    #[serde(rename = "code")]
    pub code: CodeableReference,
    /// 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>,
    /** **Date of the procedure (when coded procedure)**

 Date of the procedure when using a coded procedure. If using a reference to a procedure, then the date on the procedure should be used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateOfService")]
    pub date_of_service: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateOfService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_of_service_ext: Option<FieldExtension>,
    /** **[procedure-type](); How this procedure value should be used in charging the account**

 How this procedure value should be used in charging the account.

 */
    #[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>>,
    /** **[procedure-package-code](); Package Code specific for billing**

 The package code can be used to group procedures that may be priced or delivered as a single product. Such as DRGs.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageCode")]
    pub package_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packageCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub package_code_ext: Vec<Option<FieldExtension>>,
    /** **Any devices that were associated with the procedure**

 Any devices that were associated with the procedure relevant to the account.

 */
    #[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>>,
}
#[cfg(feature = "builders")]
impl AccountProcedure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountProcedureBuilder {
        AccountProcedureBuilder::default()
    }
}
/// Sub-fields of the relatedAccount 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 = "AccountRelatedAccountBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountRelatedAccount {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Relationship of the associated Account.

 */
    #[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>,
    /** **Reference to an associated Account**

 Reference to an associated Account.

 */
    #[serde(rename = "account")]
    pub account: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub account_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AccountRelatedAccount {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountRelatedAccountBuilder {
        AccountRelatedAccountBuilder::default()
    }
}
/// Sub-fields of the balance 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 = "AccountBalanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountBalance {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Who is expected to pay this part of the balance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "aggregate")]
    pub aggregate: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_aggregate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub aggregate_ext: Option<FieldExtension>,
    /** **[AccountBalanceTerm](http://hl7.org/fhir/ValueSet/account-balance-term); current | 30 | 60 | 90 | 120**

 The term of the account balances - The balance value is the amount that was outstanding for this age.

 */
    #[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>,
    /** **Estimated balance**

 The amount is only an estimated value - this is likely common for `current` term balances, but not with known terms (that were generated by a backend process).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "estimate")]
    pub estimate: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_estimate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub estimate_ext: Option<FieldExtension>,
    /** **Calculated amount**

 The actual balance value calculated for the age defined in the term property.

 */
    #[serde(rename = "amount")]
    pub amount: 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 AccountBalance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountBalanceBuilder {
        AccountBalanceBuilder::default()
    }
}
/** This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.

 **[ActivityDefinition](http://hl7.org/fhir/StructureDefinition/ActivityDefinition) v5.0.0**

 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>);
/** This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.

 **[ActivityDefinition](http://hl7.org/fhir/StructureDefinition/ActivityDefinition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this activity definition, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this activity definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the activity definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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 reference to a particular business version of the activity definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ActivityDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ActivityDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Subordinate title of the activity definition**

 An explanatory or alternate title for the activity definition giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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>,
    /** **Type of individual the activity definition is intended for**

 A code, group definition, or canonical reference that describes  or identifies the intended subject of the activity being defined.  Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.

 Note that the choice of canonical for the subject element was introduced in R4B to support pharmaceutical quality use cases. To ensure as much backwards-compatibility as possible, it is recommended to only use the new canonical type with these use cases. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<ActivityDefinitionSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<ActivityDefinitionSubjectExtension>,
    /** **Date last changed**

 The date  (and optionally time) when the activity definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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>,
    /** **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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 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 activity definition is presumed to be the predominant language in the place the activity definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate activity definition instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 activity definition is defined**

 Explanation 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 activity definition**

 A detailed description of how the activity definition 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>,
    /** **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.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 an activity definition  determines when the content is applicable for usage and is independent of publication and review dates. For example, a activity intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[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.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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 activity definition**

 A reference to a Library resource containing any formal logic used by the activity 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<String>>,
    /// 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/request-resource-types); Kind of resource**

 A description of the kind of resource the activity definition is representing. For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.

 The kind element may only specify Request resource types to facilitate considering user input as part of processing the result of any automated clinical reasoning processes. To support creation of event resources, such as Observations, RiskAssessments, and DetectedIssues, use a Task resource with the focus of the task set to the event resource to be created. Note that the kind of resource to be created 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<String>,
    /// 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>,
    /** **What profile the resource needs to conform to**

 A profile to which the target of the activity definition is expected to conform.

 */
    #[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>,
    /** **[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>,
    /** **[RequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the level of authority/intentionality associated with the activity and where the request should fit into the workflow chain.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intent")]
    pub intent: Option<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 activity  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 the activity should not be performed**

 Set this to true if the definition is to indicate that a particular activity should NOT be performed. If true, this element should be interpreted to reinforce a negative coding. For example NPO as a code with a doNotPerform of true would still indicate to NOT perform the action.

 This element is not intended to be used to communicate a decision support response to cancel an order in progress. That should be done with the "remove" type of a PlanDefinition or RequestOrchestration. */
    #[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>,
    /** **When activity is to occur**

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

 The intent of the timing element is to provide timing when the action should be performed. As a definitional resource, this timing is interpreted as part of an apply operation so that the timing of the result actions in a CarePlan or RequestOrchestration, for example, would be specified by evaluating the timing definition in the context of the apply and setting the resulting timing on the appropriate elements of the target resource. If the timing is an Age, the activity is expected to be performed when the subject is the given Age. When the timing is a Duration, the activity is expected to be performed within the specified duration from the apply. When the timing is a Range, it may be a range of Ages or Durations, providing a range for the expected timing of the resulting activity. When the timing is a Timing, it is establishing a schedule for the timing of the resulting activity. */
    #[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>,
    /** **Preconditions for service**

 If a CodeableConcept is present, it indicates the pre-condition for performing the service.  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<ActivityDefinitionAsNeeded>,
    /// 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<ActivityDefinitionAsNeededExtension>,
    /** **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<CodeableReference>,
    /// 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 ServiceRequest.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>>,
    /** **What specimens are required to perform this action**

 Defines specimen requirements for the action to be performed, such as required specimens for a lab test.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimenRequirement")]
    pub specimen_requirement: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specimenRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specimen_requirement_ext: Vec<Option<FieldExtension>>,
    /** **What observations are required to perform this action**

 Defines observation requirements for the action to be performed, such as body weight or surface area.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observationRequirement")]
    pub observation_requirement: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_observationRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub observation_requirement_ext: Vec<Option<FieldExtension>>,
    /** **What observations must be produced by this action**

 Defines the observations that are expected to be produced by the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observationResultRequirement")]
    pub observation_result_requirement: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_observationResultRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub observation_result_requirement_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.

 Note that if both a transform and dynamic values are specified, the dynamic values will be applied to the result of the transform. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<String>,
    /// 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 request resource that would contain the result.

 Dynamic values are applied in the order in which they are defined in the ActivityDefinition. Note that if both a transform and dynamic values are specified, the dynamic values will be applied to the result of the transform. */
    #[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 versionAlgorithm[x] field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ActivityDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
    /// Variant accepting the Canonical type.
    #[serde(rename = "subjectCanonical")]
    Canonical(String),
}
/// Extension value for ActivityDefinitionSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_subjectCanonical")]
    Canonical(FieldExtension),
}
/// 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 Age type.
    #[serde(rename = "timingAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "timingRange")]
    Range(Range),
    /// Variant accepting the Duration type.
    #[serde(rename = "timingDuration")]
    Duration(Duration),
}
/// 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 Age extension.
    #[serde(rename = "_timingAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_timingRange")]
    Range(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_timingDuration")]
    Duration(FieldExtension),
}
/// Choice of types for the asNeeded[x] field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionAsNeeded {
    /// Variant accepting the Boolean type.
    #[serde(rename = "asNeededBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "asNeededCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for ActivityDefinitionAsNeeded.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionAsNeededExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_asNeededBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_asNeededCodeableConcept")]
    CodeableConcept(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson**

 The type of participant in the action.

 */
    #[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::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>,
    /** **Who or what can participate**

 The type of participant in the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeCanonical")]
    pub type_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_canonical_ext: Option<FieldExtension>,
    /** **Who or what can participate**

 The type of participant in the action.

 When this element is a reference, it SHOULD be a reference to a definitional resource (for example, a location type, rather than a specific location). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeReference")]
    pub type_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_reference_ext: Option<FieldExtension>,
    /** **[ActivityParticipantRole](http://terminology.hl7.org/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>,
    /** **[ActionParticipantFunction](http://hl7.org/fhir/ValueSet/action-participant-function); E.g. Author, Reviewer, Witness, etc**

 Indicates how the actor will be involved in the action - author, reviewer, witness, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).

 The path attribute contains a [Simple FHIRPath Subset](fhirpath.html#simple) that allows path traversal, but not calculation. */
    #[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>,
    /** **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(rename = "expression")]
    pub expression: Expression,
    /// 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()
    }
}
/** The ActorDefinition resource is used to describe an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 **[ActorDefinition](http://hl7.org/fhir/StructureDefinition/ActorDefinition) v5.0.0**

 An application that exchanges data

 Describes an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ActorDefinition(pub Box<ActorDefinitionInner>);
/** The ActorDefinition resource is used to describe an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 **[ActorDefinition](http://hl7.org/fhir/StructureDefinition/ActorDefinition) v5.0.0**

 An application that exchanges data

 Describes an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ActorDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ActorDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ActorDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ActorDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this actor definition, represented as a URI (globally unique)**

 An absolute URI that is used to identify this actor definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this actor definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the actor definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 actor definition (business identifier)**

 A formal identifier that is used to identify this actor definition when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **Business version of the actor definition**

 The identifier that is used to identify this version of the actor definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the actor 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 actor definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the actor definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ActorDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ActorDefinitionVersionAlgorithmExtension>,
    /** **Name for this actor definition (computer friendly)**

 A natural language name identifying the actor 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 alphanumeric type name to ensure that it is machine-processing 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 actor definition (human friendly)**

 A short, descriptive, user-friendly title for the actor 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 actor definition. Enables tracking the life-cycle of the content.

 Allows filtering of actor definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 actor definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of actor definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the actor definition was last significantly changed. The date must change 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 actor definition changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the actor definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the actor definition.

 Usually an organization but may be an individual. The publisher (or steward) of the actor definition is the organization or individual primarily responsible for the maintenance and upkeep of the actor 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 actor 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 actor**

 A free text natural language description of the actor.

 This description can be used for a general description of the actor, and which covers why it was defined. */
    #[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 context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate actor definition instances.

 When multiple useContexts are specified, there is no expectation that 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 actor definition (if applicable)**

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

 It may be possible for the actor definition to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 actor definition is defined**

 Explanation of why this actor definition is needed and why it has been designed as it has.

 This element does not describe the usage of the actor 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 actor 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 actor definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the actor 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **[ExampleScenarioActorType](http://hl7.org/fhir/ValueSet/examplescenario-actor-type); person | system**

 Whether the actor represents a human or an appliction.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ExampleScenarioActorType,
    /// 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>,
    /** **Functionality associated with the actor**

 Documentation about the functionality of the actor.

 In general terms, the description desribes what the actor is, and this element describes what the actor does (or is expected to do). */
    #[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>,
    /** **Reference to more information about the actor**

 A reference to additional documentation about the actor, but description and documentation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<Option<FieldExtension>>,
    /** **CapabilityStatement for the actor (if applicable)**

 The capability statement for the actor (if the concept is applicable).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "capabilities")]
    pub capabilities: Option<String>,
    /// 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>,
    /** **Definition of this actor in another context / IG**

 A url that identifies the definition of this actor in another IG (which IG must be listed in the dependencies). This actor inherits all the obligations etc. as defined in the other IG.

 */
    #[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<String>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl ActorDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ActorDefinition", ".")]
    pub fn build(self) -> Result<ActorDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ActorDefinitionInner> for ActorDefinition {
    fn from(inner: ActorDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ActorDefinition {
    type Target = ActorDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ActorDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ActorDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ActorDefinitionBuilder {
        ActorDefinitionBuilder::default()
    }
}
impl ActorDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ActorDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in ActorDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActorDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ActorDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActorDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/** A medicinal product in the final form which is suitable for administering to a patient (after any mixing of multiple components, dissolution etc. has been performed).

 **[AdministrableProductDefinition](http://hl7.org/fhir/StructureDefinition/AdministrableProductDefinition) v5.0.0**

 A medicinal product in the final form, suitable for administration - after any mixing of multiple components

 A medicinal product in the final form which is suitable for administering to a patient (after any mixing of multiple components, dissolution etc. has been performed).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AdministrableProductDefinition(pub Box<AdministrableProductDefinitionInner>);
/** A medicinal product in the final form which is suitable for administering to a patient (after any mixing of multiple components, dissolution etc. has been performed).

 **[AdministrableProductDefinition](http://hl7.org/fhir/StructureDefinition/AdministrableProductDefinition) v5.0.0**

 A medicinal product in the final form, suitable for administration - after any mixing of multiple components

 A medicinal product in the final form which is suitable for administering to a patient (after any mixing of multiple components, dissolution etc. has been 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 = "AdministrableProductDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AdministrableProductDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "AdministrableProductDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::AdministrableProductDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 administrable product**

 An identifier for the administrable product.

 */
    #[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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this administrable product. Enables tracking the life-cycle of the content.

 Allows filtering of administrable products that are appropriate for use versus not. */
    #[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>,
    /** **References a product from which one or more of the constituent parts of that product can be prepared and used as described by this administrable product**

 References a product from which one or more of the constituent parts of that product can be prepared and used as described by this administrable product.  If this administrable product describes the administration of a crushed tablet, the 'formOf' would be the product representing a distribution containing tablets and possibly also a cream.  This is distinct from the 'producedFrom' which refers to the specific components of the product that are used in this preparation, rather than the product as a whole.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "formOf")]
    pub form_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_formOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub form_of_ext: Vec<Option<FieldExtension>>,
    /** **[AdministrableDoseForm](http://hl7.org/fhir/ValueSet/administrable-dose-form); The dose form of the final product after necessary reconstitution or processing**

 The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administrableDoseForm")]
    pub administrable_dose_form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_administrableDoseForm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub administrable_dose_form_ext: Option<FieldExtension>,
    /** **[UnitOfPresentation](http://hl7.org/fhir/ValueSet/unit-of-presentation); The presentation type in which this item is given to a patient. e.g. for a spray - 'puff'**

 The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitOfPresentation")]
    pub unit_of_presentation: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitOfPresentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_of_presentation_ext: Option<FieldExtension>,
    /** **Indicates the specific manufactured items that are part of the 'formOf' product that are used in the preparation of this specific administrable form**

 Indicates the specific manufactured items that are part of the 'formOf' product that are used in the preparation of this specific administrable form.  In some cases, an administrable form might use all of the items from the overall product (or there might only be one item), while in other cases, an administrable form might use only a subset of the items available in the overall product.  For example, an administrable form might involve combining a liquid and a powder available as part of an overall product, but not involve applying the also supplied cream.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "producedFrom")]
    pub produced_from: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_producedFrom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub produced_from_ext: Vec<Option<FieldExtension>>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton, or using by incoming references from the Ingredient resource**

 The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product**

 A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged.

 */
    #[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>,
    /** **A general description of the product, when in its final form, suitable for administration e.g. effervescent blue liquid, to be swallowed**

 A general description of the product, when in its final form, suitable for administration e.g. effervescent blue liquid, to be swallowed. Intended to be used when the other structured properties of this resource are insufficient or cannot be supported. It is not intended to duplicate information already carried elswehere.

 */
    #[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>,
    /** **Characteristics e.g. a product's onset of action**

 Characteristics e.g. a product's onset of action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<AdministrableProductDefinitionProperty>>,
    /// 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>>,
    /** **The path by which the product is taken into or makes contact with the body**

 The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route. RouteOfAdministration cannot be used when the 'formOf' product already uses MedicinalProductDefinition.route (and vice versa).

 */
    #[serde(rename = "routeOfAdministration")]
    pub route_of_administration: Vec<
        Option<AdministrableProductDefinitionRouteOfAdministration>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_routeOfAdministration")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub route_of_administration_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AdministrableProductDefinitionBuilder {
    #[doc = concat!("Finalize building ", "AdministrableProductDefinition", ".")]
    pub fn build(
        self,
    ) -> Result<AdministrableProductDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AdministrableProductDefinitionInner> for AdministrableProductDefinition {
    fn from(inner: AdministrableProductDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for AdministrableProductDefinition {
    type Target = AdministrableProductDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for AdministrableProductDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl AdministrableProductDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AdministrableProductDefinitionBuilder {
        AdministrableProductDefinitionBuilder::default()
    }
}
impl AdministrableProductDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::AdministrableProductDefinition
    }
}
/// Sub-fields of the property field in AdministrableProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdministrableProductDefinitionPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdministrableProductDefinitionProperty {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A code expressing the type of characteristic.

 */
    #[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>,
    /** **A value for the characteristic**

 A value for the characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<AdministrableProductDefinitionPropertyValue>,
    /// 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<AdministrableProductDefinitionPropertyValueExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); The status of characteristic e.g. assigned or pending**

 The status of characteristic e.g. assigned or pending.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 AdministrableProductDefinitionProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdministrableProductDefinitionPropertyBuilder {
        AdministrableProductDefinitionPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in AdministrableProductDefinitionProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdministrableProductDefinitionPropertyValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for AdministrableProductDefinitionPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdministrableProductDefinitionPropertyValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(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 routeOfAdministration field in AdministrableProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdministrableProductDefinitionRouteOfAdministrationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdministrableProductDefinitionRouteOfAdministration {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Coded expression for the route.

 */
    #[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 first dose (dose quantity) administered can be specified for the product**

 The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "firstDose")]
    pub first_dose: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_firstDose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub first_dose_ext: Option<FieldExtension>,
    /** **The maximum single dose that can be administered**

 The maximum single dose that can be administered, specified using a numerical value and its unit of measurement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxSingleDose")]
    pub max_single_dose: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxSingleDose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_single_dose_ext: Option<FieldExtension>,
    /** **The maximum dose quantity to be administered in any one 24-h period**

 The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxDosePerDay")]
    pub max_dose_per_day: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxDosePerDay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_dose_per_day_ext: Option<FieldExtension>,
    /** **The maximum dose per treatment period that can be administered**

 The maximum dose per treatment period that can be administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxDosePerTreatmentPeriod")]
    pub max_dose_per_treatment_period: Option<Ratio>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxDosePerTreatmentPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_dose_per_treatment_period_ext: Option<FieldExtension>,
    /** **The maximum treatment period during which the product can be administered**

 The maximum treatment period during which the product can be administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxTreatmentPeriod")]
    pub max_treatment_period: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxTreatmentPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_treatment_period_ext: Option<FieldExtension>,
    /** **A species for which this route applies**

 A species for which this route applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetSpecies")]
    pub target_species: Vec<
        Option<AdministrableProductDefinitionRouteOfAdministrationTargetSpecies>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_targetSpecies")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_species_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AdministrableProductDefinitionRouteOfAdministration {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdministrableProductDefinitionRouteOfAdministrationBuilder {
        AdministrableProductDefinitionRouteOfAdministrationBuilder::default()
    }
}
/// Sub-fields of the targetSpecies field in AdministrableProductDefinitionRouteOfAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdministrableProductDefinitionRouteOfAdministrationTargetSpecies {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Coded expression for the species.

 */
    #[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>,
    /** **A species specific time during which consumption of animal product is not appropriate**

 A species specific time during which consumption of animal product is not appropriate.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "withdrawalPeriod")]
    pub withdrawal_period: Vec<
        Option<
            AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriod,
        >,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_withdrawalPeriod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub withdrawal_period_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AdministrableProductDefinitionRouteOfAdministrationTargetSpecies {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesBuilder {
        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesBuilder::default()
    }
}
/// Sub-fields of the withdrawalPeriod field in AdministrableProductDefinitionRouteOfAdministrationTargetSpecies
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriod {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Coded expression for the type of tissue for which the withdrawal period applies, e.g. meat, milk.

 */
    #[serde(rename = "tissue")]
    pub tissue: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tissue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tissue_ext: Option<FieldExtension>,
    /** **A value for the time**

 A value for the time.

 */
    #[serde(rename = "value")]
    pub value: Quantity,
    /// 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>,
    /** **Extra information about the withdrawal period**

 Extra information about the withdrawal period.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub supporting_information_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriod {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodBuilder {
        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodBuilder::default()
    }
}
/** An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research participant. The unintended effects may require additional monitoring, treatment, hospitalization, or may result in death. The AdverseEvent resource also extends to potential or avoided events that could have had such effects. There are two major domains where the AdverseEvent resource is expected to be used. One is in clinical care reported adverse events and the other is in reporting adverse events in clinical  research trial management.  Adverse events can be reported by healthcare providers, patients, caregivers or by medical products manufacturers.  Given the differences between these two concepts, we recommend consulting the domain specific implementation guides when implementing the AdverseEvent Resource. The implementation guides include specific extensions, value sets and constraints.

 **[AdverseEvent](http://hl7.org/fhir/StructureDefinition/AdverseEvent) v5.0.0**

 An event that may be related to unintended effects on a patient or research participant

 An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research participant. The unintended effects may require additional monitoring, treatment, hospitalization, or may result in death. The AdverseEvent resource also extends to potential or avoided events that could have had such effects. There are two major domains where the AdverseEvent resource is expected to be used. One is in clinical care reported adverse events and the other is in reporting adverse events in clinical  research trial management. Adverse events can be reported by healthcare providers, patients, caregivers or by medical products manufacturers. Given the differences between these two concepts, we recommend consulting the domain specific implementation guides when implementing the AdverseEvent Resource. The implementation guides include specific extensions, value sets and constraints.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AdverseEvent(pub Box<AdverseEventInner>);
/** An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research participant. The unintended effects may require additional monitoring, treatment, hospitalization, or may result in death. The AdverseEvent resource also extends to potential or avoided events that could have had such effects. There are two major domains where the AdverseEvent resource is expected to be used. One is in clinical care reported adverse events and the other is in reporting adverse events in clinical  research trial management.  Adverse events can be reported by healthcare providers, patients, caregivers or by medical products manufacturers.  Given the differences between these two concepts, we recommend consulting the domain specific implementation guides when implementing the AdverseEvent Resource. The implementation guides include specific extensions, value sets and constraints.

 **[AdverseEvent](http://hl7.org/fhir/StructureDefinition/AdverseEvent) v5.0.0**

 An event that may be related to unintended effects on a patient or research participant

 An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research participant. The unintended effects may require additional monitoring, treatment, hospitalization, or may result in death. The AdverseEvent resource also extends to potential or avoided events that could have had such effects. There are two major domains where the AdverseEvent resource is expected to be used. One is in clinical care reported adverse events and the other is in reporting adverse events in clinical  research trial management. Adverse events can be reported by healthcare providers, patients, caregivers or by medical products manufacturers. Given the differences between these two concepts, we recommend consulting the domain specific implementation guides when implementing the AdverseEvent Resource. The implementation guides include specific extensions, value sets and constraints.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[AdverseEventStatus](http://hl7.org/fhir/ValueSet/adverse-event-status); in-progress | completed | entered-in-error | unknown**

 The current state of the adverse event or potential adverse event.

 This is not the reporting of the event to any regulatory or quality organization.  This is not the outcome of the patient's condition. */
    #[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>,
    /** **[AdverseEventActuality](http://hl7.org/fhir/ValueSet/adverse-event-actuality); actual | potential**

 Whether the event actually happened or was a near miss. Note that this is independent of whether anyone was affected or harmed or how severely.

 AllergyIntolerance should be used for the initial capture or recording of the individual's propensity to an adverse reaction to a substance.  If an AllergyIntolerance does not exist, then an adverse reaction should be recorded as an AllergyIntolerance. If an AllergyIntolerance does exist and the substance was given, then an adverse reaction should be recorded as an AdverseEvent due to the aberrant workflow. */
    #[serde(rename = "actuality")]
    pub actuality: codes::AdverseEventActuality,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actuality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actuality_ext: Option<FieldExtension>,
    /** **[AdverseEventCategory](http://hl7.org/fhir/ValueSet/adverse-event-category); wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site**

 The overall type of event, intended for search and filtering 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>>,
    /** **[AdverseEventType](http://hl7.org/fhir/ValueSet/adverse-event-type); Event or incident that occurred or was averted**

 Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.

 */
    #[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>,
    /** **Subject impacted by event**

 This subject or group impacted by the event.

 If AdverseEvent.resultingEffect differs among members of the group, then use Patient as the subject. */
    #[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 Encounter associated with the start of the AdverseEvent**

 The Encounter associated with the start of the AdverseEvent.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. For example, if a medication administration was considered an adverse event because it resulted in a rash, then the encounter when the medication administration was given is the associated encounter. If the patient reports the AdverseEvent during a second encounter, that second encounter is not the associated encounter. */
    #[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 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(flatten)]
    pub occurrence: Option<AdverseEventOccurrence>,
    /// 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<AdverseEventOccurrenceExtension>,
    /** **When the event was detected**

 Estimated or actual date the AdverseEvent began, in the opinion of the reporter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detected")]
    pub detected: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detected")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detected_ext: Option<FieldExtension>,
    /** **When the event was recorded**

 The date on which the existence of the AdverseEvent was first recorded.

 The recordedDate represents the date when this particular AdverseEvent record was created in the system, not the date of the most recent update.  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 = "recordedDate")]
    pub recorded_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recordedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_date_ext: Option<FieldExtension>,
    /** **Effect on the subject due to this event**

 Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resultingEffect")]
    pub resulting_effect: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resultingEffect")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resulting_effect_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); Seriousness or gravity of the event**

 Assessment whether this event, or averted event, was of clinical importance.

 Using an example, a rash can have an AdverseEvent.resultingEffect.severity = severe, yet an AdverseEvent.seriousness = non-serious.  Alternatively, a medication given with the wrong dose (chemotherapy given with too low of a dose) can have an AdverseEvent.resultingEffect.severity = mild, yet an adverseEvent.seriousness = serious.  Another example would be a beta blocker clinical trial where patients with asthma should be excluded, yet a patient with asthma was included and had an asthmatic episode where  AdverseEvent.resultingEffect.severity = mild, yet an adverseEvent.seriousness = serious. */
    #[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); Type of outcome from the adverse event**

 Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_ext: Vec<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 and what they did**

 Indicates who or what participated in the adverse event and how they were involved.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<AdverseEventParticipant>>,
    /// 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>>,
    /** **Research study that the subject is enrolled in**

 The research study that the subject is enrolled in.

 */
    #[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>>,
    /** **Considered likely or probable or anticipated in the research study**

 Considered likely or probable or anticipated in the research study.  Whether the reported event matches any of the outcomes for the patient that are considered by the study as known or likely.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expectedInResearchStudy")]
    pub expected_in_research_study: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expectedInResearchStudy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expected_in_research_study_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>>,
    /** **Contributing factors suspected to have increased the probability or severity of the adverse event**

 The contributing factors suspected to have increased the probability or severity of the adverse event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributingFactor")]
    pub contributing_factor: Vec<Option<AdverseEventContributingFactor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributingFactor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributing_factor_ext: Vec<Option<FieldExtension>>,
    /** **Preventive actions that contributed to avoiding the adverse event**

 Preventive actions that contributed to avoiding the adverse event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preventiveAction")]
    pub preventive_action: Vec<Option<AdverseEventPreventiveAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_preventiveAction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub preventive_action_ext: Vec<Option<FieldExtension>>,
    /** **Ameliorating actions taken after the adverse event occured in order to reduce the extent of harm**

 The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mitigatingAction")]
    pub mitigating_action: Vec<Option<AdverseEventMitigatingAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mitigatingAction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mitigating_action_ext: Vec<Option<FieldExtension>>,
    /** **Supporting information relevant to the event**

 Supporting information relevant to the event.

 */
    #[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<AdverseEventSupportingInfo>>,
    /// 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>>,
    /** **Comment on adverse event**

 Comments made about the adverse 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>>,
}
#[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
    }
}
/// Choice of types for the occurrence[x] field in AdverseEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventOccurrence {
    /// 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 AdverseEventOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventOccurrenceExtension {
    /// 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 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 = "AdverseEventParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventParticipant {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.

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

 Indicates who or what participated in the event.

 For example, the physician prescribing a drug, a nurse administering the drug, a device that administered the drug, a witness to the event, or an informant of clinical history. */
    #[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 AdverseEventParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventParticipantBuilder {
        AdverseEventParticipantBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(flatten)]
    pub instance: AdverseEventSuspectEntityInstance,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instance_ext: Option<AdverseEventSuspectEntityInstanceExtension>,
    /** **Information on the possible cause of the event**

 Information on the possible cause of the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causality")]
    pub causality: Option<AdverseEventSuspectEntityCausality>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl AdverseEventSuspectEntity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventSuspectEntityBuilder {
        AdverseEventSuspectEntityBuilder::default()
    }
}
/// Choice of types for the instance[x] field in AdverseEventSuspectEntity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventSuspectEntityInstance {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "instanceCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "instanceReference")]
    Reference(Reference),
}
/// Extension value for AdverseEventSuspectEntityInstance.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventSuspectEntityInstanceExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_instanceCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_instanceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the causality field in AdverseEventSuspectEntity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdverseEventSuspectEntityCausalityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventSuspectEntityCausality {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The method of evaluating the relatedness of the suspected entity to the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assessmentMethod")]
    pub assessment_method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assessmentMethod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assessment_method_ext: Option<FieldExtension>,
    /** **[AdverseEventCausalityAssessment](http://hl7.org/fhir/ValueSet/adverse-event-causality-assess); Result of the assessment regarding the relatedness of the suspected entity to the event**

 The result of the assessment regarding the relatedness of the suspected entity to the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entityRelatedness")]
    pub entity_relatedness: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_entityRelatedness")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entity_relatedness_ext: Option<FieldExtension>,
    /** **Author of the information on the possible cause of the event**

 The author of the information on the possible cause of the event.

 */
    #[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 AdverseEventSuspectEntityCausality {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventSuspectEntityCausalityBuilder {
        AdverseEventSuspectEntityCausalityBuilder::default()
    }
}
/// Sub-fields of the contributingFactor 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 = "AdverseEventContributingFactorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventContributingFactor {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 suspected to have increased the probability or severity of the adverse event**

 The item that is suspected to have increased the probability or severity of the adverse event.

 */
    #[serde(flatten)]
    pub item: AdverseEventContributingFactorItem,
    /// 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<AdverseEventContributingFactorItemExtension>,
}
#[cfg(feature = "builders")]
impl AdverseEventContributingFactor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventContributingFactorBuilder {
        AdverseEventContributingFactorBuilder::default()
    }
}
/// Choice of types for the item[x] field in AdverseEventContributingFactor
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventContributingFactorItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for AdverseEventContributingFactorItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventContributingFactorItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the preventiveAction 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 = "AdverseEventPreventiveActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventPreventiveAction {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The action that contributed to avoiding the adverse event.

 */
    #[serde(flatten)]
    pub item: AdverseEventPreventiveActionItem,
    /// 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<AdverseEventPreventiveActionItemExtension>,
}
#[cfg(feature = "builders")]
impl AdverseEventPreventiveAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventPreventiveActionBuilder {
        AdverseEventPreventiveActionBuilder::default()
    }
}
/// Choice of types for the item[x] field in AdverseEventPreventiveAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventPreventiveActionItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for AdverseEventPreventiveActionItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventPreventiveActionItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the mitigatingAction 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 = "AdverseEventMitigatingActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventMitigatingAction {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.

 */
    #[serde(flatten)]
    pub item: AdverseEventMitigatingActionItem,
    /// 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<AdverseEventMitigatingActionItemExtension>,
}
#[cfg(feature = "builders")]
impl AdverseEventMitigatingAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventMitigatingActionBuilder {
        AdverseEventMitigatingActionBuilder::default()
    }
}
/// Choice of types for the item[x] field in AdverseEventMitigatingAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventMitigatingActionItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for AdverseEventMitigatingActionItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventMitigatingActionItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the supportingInfo 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 = "AdverseEventSupportingInfoBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventSupportingInfo {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.

 */
    #[serde(flatten)]
    pub item: AdverseEventSupportingInfoItem,
    /// 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<AdverseEventSupportingInfoItemExtension>,
}
#[cfg(feature = "builders")]
impl AdverseEventSupportingInfo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventSupportingInfoBuilder {
        AdverseEventSupportingInfoBuilder::default()
    }
}
/// Choice of types for the item[x] field in AdverseEventSupportingInfo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventSupportingInfoItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for AdverseEventSupportingInfoItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AdverseEventSupportingInfoItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.

 **[AllergyIntolerance](http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) v5.0.0**

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

 Risk of harmful or undesirable physiological response which is specific 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>);
/** Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.

 **[AllergyIntolerance](http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) v5.0.0**

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

 Risk of harmful or undesirable physiological response which is specific 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this AllergyIntolerance by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[AllergyIntoleranceClinicalStatus](http://hl7.org/fhir/ValueSet/allergyintolerance-clinical); active | inactive | resolved**

 The clinical status of the allergy or intolerance.

 AllergyIntolerance.clinicalStatus should be present if verificationStatus is not entered-in-error and the AllergyIntolerance.code isn't negated (No Known Allergy, No Drug Allergy, No Food Allergy, No Latex Allergy).
Refer to [discussion](extensibility.html#Special-Case) if clinicalStatus is missing data.
The data type is CodeableConcept because clinicalStatus has some clinical judgment involved, such that there might need to be more specificity than the required FHIR value set allows. For example, a SNOMED coding might allow for additional specificity. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalStatus")]
    pub clinical_status: Option<CodeableConcept>,
    /// 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/allergyintolerance-verification); unconfirmed | presumed | 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).  The verification status pertains to the allergy or intolerance, itself, not to any specific AllergyIntolerance attribute.

 The data type is CodeableConcept because verificationStatus has some clinical judgment involved, such that there might need to be more specificity than the required FHIR value set allows. For example, a SNOMED coding might allow for additional specificity. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verificationStatus")]
    pub verification_status: Option<CodeableConcept>,
    /// 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 might 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 might 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<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>,
    /** **[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").  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'.  If a receiving system is unable to confirm that AllergyIntolerance.reaction.substance falls within the semantic scope of AllergyIntolerance.code, then the receiving system should ignore AllergyIntolerance.reaction.substance.

 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, UNII, and ATC. 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 allergy or intolerance 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>,
    /** **Encounter when the allergy or intolerance was asserted**

 The encounter when the allergy or intolerance was asserted.

 */
    #[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 allergy or intolerance was identified**

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

 Age is generally used when the patient reports an age at which the AllergyIntolerance was noted. Period is generally used to convey an imprecise onset that occurred within the time period.  Range is generally used to convey an imprecise age range (e.g. 4 to 6 years old). */
    #[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 allergy or intolerance was first recorded**

 The recordedDate represents when this particular AllergyIntolerance record was created in the system, which is often a system-generated date.

 When onset date is unknown, recordedDate can be used to establish if the allergy or intolerance was present on or before a given date.  If the recordedDate is known and provided by a sending system, it is preferred that the receiving system preserve that recordedDate value. If the recordedDate is not provided by the sending system, the receipt timestamp is sometimes used as the recordedDate. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recordedDate")]
    pub recorded_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recordedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_date_ext: Option<FieldExtension>,
    /** **Who or what participated in the activities related to the allergy or intolerance and how they were involved**

 Indicates who or what participated in the activities related to the allergy or intolerance and how they were involved.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<AllergyIntoleranceParticipant>>,
    /// 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>>,
    /** **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 AllergyIntolerance.note 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 participant 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 = "AllergyIntoleranceParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AllergyIntoleranceParticipant {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Distinguishes the type of involvement of the actor in the activities related to the allergy or intolerance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who or what participated in the activities related to the allergy or intolerance**

 Indicates who or what participated in the activities related to the allergy or intolerance.

 */
    #[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 AllergyIntoleranceParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AllergyIntoleranceParticipantBuilder {
        AllergyIntoleranceParticipantBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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'.  If a receiving system is unable to confirm that AllergyIntolerance.reaction.substance falls within the semantic scope of AllergyIntolerance.code, then the receiving system should ignore AllergyIntolerance.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 identified 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<CodeableReference>>,
    /// 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 note 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 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()
    }
}
/** 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).

 **[Appointment](http://hl7.org/fhir/StructureDefinition/Appointment) v5.0.0**

 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>);
/** 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).

 **[Appointment](http://hl7.org/fhir/StructureDefinition/Appointment) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | checked-in | waitlist**

 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>,
    /** **[cancellation-reason](http://hl7.org/fhir/ValueSet/appointment-cancellation-reason); The coded reason for the appointment being cancelled**

 The coded reason for the appointment being cancelled. This is often used in reporting/billing/futher processing to determine if further actions are required, or specific fees apply.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cancellationReason")]
    pub cancellation_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cancellationReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cancellation_reason_ext: Option<FieldExtension>,
    /** **[EncounterClass](http://terminology.hl7.org/ValueSet/EncounterClass); Classification when becoming an encounter**

 Concepts representing classification of patient encounter such as ambulatory (outpatient), inpatient, emergency, home health or others due to local variations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[service-category](http://hl7.org/fhir/ValueSet/service-category); A broad categorization of the service that is to be performed during this appointment**

 A broad categorization of the 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 = "serviceCategory")]
    pub service_category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_category_ext: Vec<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.

 For a provider to provider appointment the code "FOLLOWUP" may be appropriate, as this is expected to be discussing some patient that was seen in the past. */
    #[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<CodeableReference>>,
    /// 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://terminology.hl7.org/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. This can be coded, or 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 = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[Priority](http://terminology.hl7.org/ValueSet/v3-ActPriority); 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<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>,
    /** **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 note 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>,
    /** **Appointment replaced by this Appointment**

 Appointment replaced by this Appointment in cases where there is a cancellation, the details of the cancellation can be found in the cancellationReason property (on the referenced resource).

 */
    #[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>>,
    /** **Connection details of a virtual service (e.g. conference call)**

 Connection details of a virtual service (e.g. conference call).

 There are two types of virtual meetings that often exist:

* a persistent, virtual meeting room that can only be used for a single purpose at a time,
* and a dynamic virtual meeting room that is generated on demand for a specific purpose.

Implementers may consider using Location.virtualService for persistent meeting rooms.

If each participant would have a different meeting link, an extension using the VirtualServiceContactDetail  can be applied to the Appointment.participant BackboneElement. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "virtualService")]
    pub virtual_service: Vec<Option<VirtualServiceDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_virtualService")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub virtual_service_ext: Vec<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>>,
    /** **The previous appointment in a series**

 The previous appointment in a series of related appointments.

 This property is intended for use when representing a series of related appointments.  For example, in a nuclear medicine procedure, where there is an appointment for the injection of the isotopes, and then a subsequent appointment for the scan, the scan appointment would refer to the injection appointment via Appointment.previousAppointment.  For representing recurring appointments, see the guidance on recurring vs. series appointments. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "previousAppointment")]
    pub previous_appointment: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_previousAppointment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub previous_appointment_ext: Option<FieldExtension>,
    /** **The originating appointment in a recurring set of appointments**

 The originating appointment in a recurring set of related appointments.

 This property is intended for use when representing a recurring set of related appointments.

For example, a patient undergoing physical therapy may have a recurring appointment every Tuesday and Thursday.  Each occurrence of the set will refer to the originating appointment, which contains the recurring template information.  For representing appointment series, see the guidance on recurring vs. series appointments. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "originatingAppointment")]
    pub originating_appointment: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_originatingAppointment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub originating_appointment_ext: Option<FieldExtension>,
    /** **When appointment is to take place**

 Date/Time that the appointment is to take place.

 If actual start/end times are not known then the requested period start/end can be used. */
    #[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.

 If actual start/end times are not known then the requested period start/end can be used. */
    #[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.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end.

 */
    #[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>,
    /** **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.

The duration (usually in minutes) could also be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time. However, in other situations the duration may be calculated by the scheduling system.

 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>>,
    /** **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 set of accounts that may be used for billing for this Appointment**

 The set of accounts that is expected to be used for billing the activities that result from this Appointment.

 The specified account(s) could be those identified during pre-registration workflows in preparation for an upcoming Encounter. */
    #[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>>,
    /** **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>,
    /** **When the appointment was cancelled**

 The date/time describing when the appointment was cancelled.

 If the appointment was cancelled multiple times, this would reflect the most recent cancellation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cancellationDate")]
    pub cancellation_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cancellationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cancellation_date_ext: Option<FieldExtension>,
    /** **Additional comments**

 Additional notes/comments about the appointment.

 Additional text to aid in facilitating the appointment. For instance, a note 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.

Typically only the concept.text will be used, however occasionally a reference to some generic documentation (or specific) and also supports coded instructions if/when they are required. */
    #[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>>,
    /** **Detailed information and instructions for the patient**

 While Appointment.note contains information for internal use, Appointment.patientInstructions is used to capture patient facing information about the Appointment (e.g. please bring your referral or fast from 8pm night before).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientInstruction")]
    pub patient_instruction: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_patientInstruction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub patient_instruction_ext: Vec<Option<FieldExtension>>,
    /** **The request this appointment is allocated to assess**

 The request this appointment is allocated to assess (e.g. incoming referral or procedure 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>>,
    /** **The patient or group associated with the appointment**

 The patient or group associated with the appointment, if they are to be present (usually) then they should also be included in the participant backbone element.

 */
    #[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>,
    /** **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>>,
    /** **The sequence number in the recurrence**

 The sequence number that identifies a specific appointment in a recurring pattern.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recurrenceId")]
    pub recurrence_id: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recurrenceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recurrence_id_ext: Option<FieldExtension>,
    /** **Indicates that this appointment varies from a recurrence pattern**

 This appointment varies from the recurring pattern.

 For example, if a patient has physical therapy appointments every Tuesday and Thursday, but due to a national holiday, a single occurrence was rescheduled to a different day, while the rest of the recurring series remained on Tuesday / Thursday. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "occurrenceChanged")]
    pub occurrence_changed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_occurrenceChanged")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_changed_ext: Option<FieldExtension>,
    /** **Details of the recurrence pattern/template used to generate occurrences**

 The details of the recurrence pattern or template that is used to generate recurring appointments.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recurrenceTemplate")]
    pub recurrence_template: Vec<Option<AppointmentRecurrenceTemplate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recurrenceTemplate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recurrence_template_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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Participation period of the actor**

 Participation period of the actor.

 */
    #[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 individual, device, location, or service participating in the appointment**

 The individual, device, location, or service participating in the appointment.

 Where a CareTeam is provided, this does not imply that the entire team is included, just a single member from the group with the appropriate role. Where multiple members are required, please include the CareTeam the required number of times. */
    #[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>,
    /** **The participant is required to attend (optional when false)**

 Whether this participant is required to be present at the meeting. If false, the participant is optional.

 For the use-case where two doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present include the patient in the subject field, but do not include them as a participant - this was formerly done prior to R5 with required='information-only'. */
    #[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>,
    /** **[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()
    }
}
/// Sub-fields of the recurrenceTemplate 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 = "AppointmentRecurrenceTemplateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AppointmentRecurrenceTemplate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The timezone of the recurring appointment occurrences.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timezone")]
    pub timezone: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_timezone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timezone_ext: Option<FieldExtension>,
    /** **[AppointmentRecurrenceType](http://hl7.org/fhir/ValueSet/appointment-recurrrence-type); The frequency of the recurrence**

 How often the appointment series should recur.

 */
    #[serde(rename = "recurrenceType")]
    pub recurrence_type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recurrenceType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recurrence_type_ext: Option<FieldExtension>,
    /** **The date when the recurrence should end**

 Recurring appointments will not occur after this date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastOccurrenceDate")]
    pub last_occurrence_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastOccurrenceDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_occurrence_date_ext: Option<FieldExtension>,
    /** **The number of planned occurrences**

 How many appointments are planned in the recurrence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "occurrenceCount")]
    pub occurrence_count: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_occurrenceCount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_count_ext: Option<FieldExtension>,
    /** **Specific dates for a recurring set of appointments (no template)**

 The list of specific dates that will have appointments generated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "occurrenceDate")]
    pub occurrence_date: Vec<Option<Date>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_occurrenceDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub occurrence_date_ext: Vec<Option<FieldExtension>>,
    /** **Information about weekly recurring appointments**

 Information about weekly recurring appointments.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "weeklyTemplate")]
    pub weekly_template: Option<AppointmentRecurrenceTemplateWeeklyTemplate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_weeklyTemplate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub weekly_template_ext: Option<FieldExtension>,
    /** **Information about monthly recurring appointments**

 Information about monthly recurring appointments.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "monthlyTemplate")]
    pub monthly_template: Option<AppointmentRecurrenceTemplateMonthlyTemplate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_monthlyTemplate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub monthly_template_ext: Option<FieldExtension>,
    /** **Information about yearly recurring appointments**

 Information about yearly recurring appointments.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "yearlyTemplate")]
    pub yearly_template: Option<AppointmentRecurrenceTemplateYearlyTemplate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_yearlyTemplate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub yearly_template_ext: Option<FieldExtension>,
    /** **Any dates that should be excluded from the series**

 Any dates, such as holidays, that should be excluded from the recurrence.

 excludingDate is an alternative to excludingRecurrenceId.  You may say either that 12/25/XXXX should be excluded using excludingDate, or you may indicate the recurrenceId of the appointment that would fall on the excluded date in the excludingRecurrenceId property. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludingDate")]
    pub excluding_date: Vec<Option<Date>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_excludingDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub excluding_date_ext: Vec<Option<FieldExtension>>,
    /** **Any recurrence IDs that should be excluded from the recurrence**

 Any dates, such as holidays, that should be excluded from the recurrence.

 excludingRecurrenceId is an alternative to excludingDate.  You may say either that 12/25/XXXX should be excluded using excludingDate, or you may indicate the recurrenceId of the appointment that would fall on the excluded date in the excludingRecurrenceId property. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludingRecurrenceId")]
    pub excluding_recurrence_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_excludingRecurrenceId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub excluding_recurrence_id_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AppointmentRecurrenceTemplate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AppointmentRecurrenceTemplateBuilder {
        AppointmentRecurrenceTemplateBuilder::default()
    }
}
/// Sub-fields of the weeklyTemplate field in AppointmentRecurrenceTemplate
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentRecurrenceTemplateWeeklyTemplateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AppointmentRecurrenceTemplateWeeklyTemplate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Indicates that recurring appointments should occur on Mondays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "monday")]
    pub monday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_monday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub monday_ext: Option<FieldExtension>,
    /** **Recurs on Tuesday**

 Indicates that recurring appointments should occur on Tuesdays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tuesday")]
    pub tuesday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tuesday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tuesday_ext: Option<FieldExtension>,
    /** **Recurs on Wednesday**

 Indicates that recurring appointments should occur on Wednesdays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "wednesday")]
    pub wednesday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_wednesday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub wednesday_ext: Option<FieldExtension>,
    /** **Recurs on Thursday**

 Indicates that recurring appointments should occur on Thursdays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "thursday")]
    pub thursday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_thursday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub thursday_ext: Option<FieldExtension>,
    /** **Recurs on Friday**

 Indicates that recurring appointments should occur on Fridays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "friday")]
    pub friday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_friday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub friday_ext: Option<FieldExtension>,
    /** **Recurs on Saturday**

 Indicates that recurring appointments should occur on Saturdays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "saturday")]
    pub saturday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_saturday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub saturday_ext: Option<FieldExtension>,
    /** **Recurs on Sunday**

 Indicates that recurring appointments should occur on Sundays.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sunday")]
    pub sunday: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sunday")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sunday_ext: Option<FieldExtension>,
    /** **Recurs every nth week**

 The interval defines if the recurrence is every nth week. The default is every week, so it is expected that this value will be 2 or more.

e.g. For recurring every second week this interval would be 2, or every third week the interval would be 3.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "weekInterval")]
    pub week_interval: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_weekInterval")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub week_interval_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AppointmentRecurrenceTemplateWeeklyTemplate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AppointmentRecurrenceTemplateWeeklyTemplateBuilder {
        AppointmentRecurrenceTemplateWeeklyTemplateBuilder::default()
    }
}
/// Sub-fields of the monthlyTemplate field in AppointmentRecurrenceTemplate
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentRecurrenceTemplateMonthlyTemplateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AppointmentRecurrenceTemplateMonthlyTemplate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Indicates that appointments in the series of recurring appointments should occur on a specific day of the month.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dayOfMonth")]
    pub day_of_month: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dayOfMonth")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub day_of_month_ext: Option<FieldExtension>,
    /** **[WeekOfMonth](http://hl7.org/fhir/ValueSet/week-of-month); Indicates which week of the month the appointment should occur**

 Indicates which week within a month the appointments in the series of recurring appointments should occur on.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nthWeekOfMonth")]
    pub nth_week_of_month: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nthWeekOfMonth")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub nth_week_of_month_ext: Option<FieldExtension>,
    /** **[DaysOfWeek](http://hl7.org/fhir/ValueSet/days-of-week); Indicates which day of the week the appointment should occur**

 Indicates which day of the week the recurring appointments should occur each nth week.

 This property is intended to be used with Appointment.recurrenceTemplate.monthly.nthWeek. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dayOfWeek")]
    pub day_of_week: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dayOfWeek")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub day_of_week_ext: Option<FieldExtension>,
    /** **Recurs every nth month**

 Indicates that recurring appointments should occur every nth month.

 */
    #[serde(rename = "monthInterval")]
    pub month_interval: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_monthInterval")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub month_interval_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AppointmentRecurrenceTemplateMonthlyTemplate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AppointmentRecurrenceTemplateMonthlyTemplateBuilder {
        AppointmentRecurrenceTemplateMonthlyTemplateBuilder::default()
    }
}
/// Sub-fields of the yearlyTemplate field in AppointmentRecurrenceTemplate
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentRecurrenceTemplateYearlyTemplateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AppointmentRecurrenceTemplateYearlyTemplate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Appointment recurs every nth year.

 */
    #[serde(rename = "yearInterval")]
    pub year_interval: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_yearInterval")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub year_interval_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AppointmentRecurrenceTemplateYearlyTemplate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AppointmentRecurrenceTemplateYearlyTemplateBuilder {
        AppointmentRecurrenceTemplateYearlyTemplateBuilder::default()
    }
}
/** A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.

 **[AppointmentResponse](http://hl7.org/fhir/StructureDefinition/AppointmentResponse) v5.0.0**

 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>);
/** A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.

 **[AppointmentResponse](http://hl7.org/fhir/StructureDefinition/AppointmentResponse) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Indicator for a counter proposal**

 Indicates that the response is proposing a different time that was initially requested.  The new proposed time will be indicated in the start and end properties.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "proposedNewTime")]
    pub proposed_new_time: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_proposedNewTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub proposed_new_time_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(s), 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/appointmentresponse-status); accepted | declined | tentative | 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: String,
    /// 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>,
    /** **This response is for all occurrences in a recurring request**

 Indicates that this AppointmentResponse applies to all occurrences in a recurring request.

 When a recurring appointment is requested, the participant may choose to respond to each individual occurrence, in which case AppointmentResponse.recurring should be false.  If the participant chooses to respond the same way for all occurrences, they may instead use a single AppointmentResponse with recurring set to true.  These may be combined as the participant chooses.  For example, they may accept all occurrences (recurring = true), but then send a decline for a specific occurrence (recurring=false). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recurring")]
    pub recurring: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recurring")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recurring_ext: Option<FieldExtension>,
    /** **Original date within a recurring request**

 The original date within a recurring request. This could be used in place of the recurrenceId to be more direct (or where the template is provided through the simple list of dates in `Appointment.occurrenceDate`).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "occurrenceDate")]
    pub occurrence_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_occurrenceDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_date_ext: Option<FieldExtension>,
    /** **The recurrence ID of the specific recurring request**

 The recurrence ID (sequence number) of the specific appointment when responding to a recurring request.

 If the recurrence template was defined using the list of occurrenceDates then this property might not be used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recurrenceId")]
    pub recurrence_id: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recurrenceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recurrence_id_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
    }
}
/** This Resource provides one or more comments, classifiers or ratings about a Resource and supports attribution and rights management metadata for the added content.

 **[ArtifactAssessment](http://hl7.org/fhir/StructureDefinition/ArtifactAssessment) v5.0.0**

 Adds metadata-supported comments, classifiers or ratings related to a Resource

 This Resource provides one or more comments, classifiers or ratings about a Resource and supports attribution and rights management metadata for the added content.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ArtifactAssessment(pub Box<ArtifactAssessmentInner>);
/** This Resource provides one or more comments, classifiers or ratings about a Resource and supports attribution and rights management metadata for the added content.

 **[ArtifactAssessment](http://hl7.org/fhir/StructureDefinition/ArtifactAssessment) v5.0.0**

 Adds metadata-supported comments, classifiers or ratings related to a Resource

 This Resource provides one or more comments, classifiers or ratings about a Resource and supports attribution and rights management metadata for the added 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 = "ArtifactAssessmentBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ArtifactAssessmentInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ArtifactAssessment::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ArtifactAssessment", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 artifact assessment**

 A formal identifier that is used to identify this artifact assessment 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, and can then 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>>,
    /** **A short title for the assessment for use in displaying and selecting**

 A short title for the assessment for use in displaying and selecting.

 */
    #[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>,
    /** **How to cite the comment or rating**

 Display of or reference to the bibliographic citation of the comment, classifier, or rating.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub cite_as: Option<ArtifactAssessmentCiteAs>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cite_as_ext: Option<ArtifactAssessmentCiteAsExtension>,
    /** **Date last changed**

 The date  (and optionally time) when the artifact assessment was published. The date must change when the disposition changes and it must change if the workflow status code changes. In addition, it should change when the substantive content of the artifact assessment changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the artifact assessment. 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>,
    /** **Use and/or publishing restrictions**

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

 */
    #[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>,
    /** **When the artifact assessment 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 or 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 artifact assessment was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original 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>,
    /** **The artifact assessed, commented upon or rated**

 A reference to a resource, canonical resource, or non-FHIR resource which the comment or assessment is about.

 */
    #[serde(flatten)]
    pub artifact: ArtifactAssessmentArtifact,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub artifact_ext: Option<ArtifactAssessmentArtifactExtension>,
    /** **Comment, classifier, or rating content**

 A component comment, classifier, or rating of the artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Vec<Option<ArtifactAssessmentContent>>,
    /// 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>>,
    /** **[WorkflowStatus](http://hl7.org/fhir/ValueSet/artifactassessment-workflow-status); submitted | triaged | waiting-for-input | resolved-no-change | resolved-change-required | deferred | duplicate | applied | published | entered-in-error**

 Indicates the workflow status of the comment or change request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "workflowStatus")]
    pub workflow_status: Option<codes::ArtifactAssessmentWorkflowStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_workflowStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub workflow_status_ext: Option<FieldExtension>,
    /** **[Disposition](http://hl7.org/fhir/ValueSet/artifactassessment-disposition); unresolved | not-persuasive | persuasive | persuasive-with-modification | not-persuasive-with-modification**

 Indicates the disposition of the responsible party to the comment or change request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<codes::ArtifactAssessmentDisposition>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl ArtifactAssessmentBuilder {
    #[doc = concat!("Finalize building ", "ArtifactAssessment", ".")]
    pub fn build(self) -> Result<ArtifactAssessment, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ArtifactAssessmentInner> for ArtifactAssessment {
    fn from(inner: ArtifactAssessmentInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ArtifactAssessment {
    type Target = ArtifactAssessmentInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ArtifactAssessment {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ArtifactAssessment {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ArtifactAssessmentBuilder {
        ArtifactAssessmentBuilder::default()
    }
}
impl ArtifactAssessment {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ArtifactAssessment
    }
}
/// Choice of types for the citeAs[x] field in ArtifactAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ArtifactAssessmentCiteAs {
    /// Variant accepting the Reference type.
    #[serde(rename = "citeAsReference")]
    Reference(Reference),
    /// Variant accepting the Markdown type.
    #[serde(rename = "citeAsMarkdown")]
    Markdown(String),
}
/// Extension value for ArtifactAssessmentCiteAs.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ArtifactAssessmentCiteAsExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_citeAsReference")]
    Reference(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_citeAsMarkdown")]
    Markdown(FieldExtension),
}
/// Choice of types for the artifact[x] field in ArtifactAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ArtifactAssessmentArtifact {
    /// Variant accepting the Reference type.
    #[serde(rename = "artifactReference")]
    Reference(Reference),
    /// Variant accepting the Canonical type.
    #[serde(rename = "artifactCanonical")]
    Canonical(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "artifactUri")]
    Uri(String),
}
/// Extension value for ArtifactAssessmentArtifact.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ArtifactAssessmentArtifactExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_artifactReference")]
    Reference(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_artifactCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_artifactUri")]
    Uri(FieldExtension),
}
/// Sub-fields of the content field in ArtifactAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ArtifactAssessmentContentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ArtifactAssessmentContent {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The type of information this component of the content represents.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationType")]
    pub information_type: Option<codes::ArtifactAssessmentInformationType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_informationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub information_type_ext: Option<FieldExtension>,
    /** **Brief summary of the content**

 A brief summary of the content of this component.

 */
    #[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>,
    /** **[EvidenceCertaintyType](http://hl7.org/fhir/ValueSet/certainty-type); What type of content**

 Indicates what type of content this component represents.

 */
    #[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>,
    /** **[EvidenceCertaintyRating](http://hl7.org/fhir/ValueSet/certainty-rating); Rating, classifier, or assessment**

 Represents a rating, classifier, or assessment of the artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **Quantitative rating**

 A quantitative rating of the artifact.

 */
    #[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>,
    /** **Who authored the content**

 Indicates who or what authored the content.

 */
    #[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>,
    /** **What the comment is directed to**

 A URI that points to what the comment is about, such as a line of text in the CQL, or a specific element in a resource.

 The target element is used to point the comment to aspect of the artifact, such as a text range within a CQL library (e.g. #content?0:0-120:80). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub path_ext: Vec<Option<FieldExtension>>,
    /** **Additional information**

 Additional related artifacts that provide supporting documentation, additional evidence, or further information related to the content.

 */
    #[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>>,
    /** **Acceptable to publicly share the resource content**

 Acceptable to publicly share the comment, classifier or rating.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "freeToShare")]
    pub free_to_share: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_freeToShare")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub free_to_share_ext: Option<FieldExtension>,
    /** **Contained content**

 If the informationType is container, the components of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<ArtifactAssessmentContent>>,
    /// 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 ArtifactAssessmentContent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ArtifactAssessmentContentBuilder {
        ArtifactAssessmentContentBuilder::default()
    }
}
/** A record of an event relevant for purposes such as operations, privacy, security, maintenance, and performance analysis.

 **[AuditEvent](http://hl7.org/fhir/StructureDefinition/AuditEvent) v5.0.0**

 Record of an event

 A record of an event relevant for purposes such as operations, privacy, security, maintenance, and performance analysis.

 Based on IHE-ATNA. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AuditEvent(pub Box<AuditEventInner>);
/** A record of an event relevant for purposes such as operations, privacy, security, maintenance, and performance analysis.

 **[AuditEvent](http://hl7.org/fhir/StructureDefinition/AuditEvent) v5.0.0**

 Record of an event

 A record of an event relevant for purposes such as operations, privacy, security, maintenance, and performance analysis.

 Based on IHE-ATNA. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Classification of the type of event.

 */
    #[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>>,
    /** **[AuditEventSubType](http://hl7.org/fhir/ValueSet/audit-event-sub-type); Specific type of event**

 Describes what happened. The most specific code for the event.

 */
    #[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>,
    /** **[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>,
    /** **[AuditEventSeverity](http://hl7.org/fhir/ValueSet/audit-event-severity); emergency | alert | critical | error | warning | notice | informational | debug**

 Indicates and enables segmentation of various severity including debugging from critical.

 ATNA will map this to the SYSLOG PRI element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "severity")]
    pub severity: Option<codes::AuditEventSeverity>,
    /// 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>,
    /** **When the activity occurred**

 The time or period during which the activity occurred.

 The time or 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(flatten)]
    pub occurred: Option<AuditEventOccurred>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurred_ext: Option<AuditEventOccurredExtension>,
    /** **Time when the event was recorded**

 The time when the event was recorded.

 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>,
    /** **Whether the event succeeded or failed**

 Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.

 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<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>,
    /** **[AuditPurposeOfUse](http://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Authorization related to the event**

 The authorization (e.g., PurposeOfUse) that was used during the event being recorded.

 Use AuditEvent.agent.authorization when you know that it is specific to the agent, otherwise use AuditEvent.authorization. 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 = "authorization")]
    pub authorization: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authorization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authorization_ext: Vec<Option<FieldExtension>>,
    /** **Workflow authorization within which this event occurred**

 Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.

 */
    #[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>>,
    /** **The patient is the subject of the data used/created/updated/deleted during the activity**

 The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.

 */
    #[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>,
    /** **Encounter within which this event occurred or which the event is tightly associated**

 This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (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 = "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>,
    /** **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.

When a network are used in an event being recorded, there should be distinct agent elements for the known actors using the network. The agent with a network detail would be the responsible agent for use of that network. */
    #[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 actor that is reporting the event.

 Events are reported by the actor that detected them. This may be one of the participating actors, but may also be different. The actor may be a human such as a medical-records clerk disclosing data manually, that clerk would be the source for the record of disclosure. */
    #[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
    }
}
/// Choice of types for the occurred[x] field in AuditEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventOccurred {
    /// Variant accepting the Period type.
    #[serde(rename = "occurredPeriod")]
    Period(Period),
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurredDateTime")]
    DateTime(DateTime),
}
/// Extension value for AuditEventOccurred.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventOccurredExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurredPeriod")]
    Period(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurredDateTime")]
    DateTime(FieldExtension),
}
/// Sub-fields of the outcome 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 = "AuditEventOutcomeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventOutcome {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<CodeableConcept>>,
    /// 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 AuditEventOutcome {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventOutcomeBuilder {
        AuditEventOutcomeBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The Functional Role of the user when performing the event.

 For example: assembler, author, prescriber, signer, investigator, 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>,
    /** **[AuditAgentRole](http://hl7.org/fhir/ValueSet/security-role-type); Agent role in the event**

 The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.

 For example: Chief-of-Radiology, Nurse, Physician, Medical-Student, 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>>,
    /** **Identifier of who**

 Reference to who this agent is that was involved in the event.

 Where a User ID is available it will go into who.identifier. Where a name of the user (human readable) it will go into who.display. */
    #[serde(rename = "who")]
    pub who: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_who")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub who_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(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestor")]
    pub requestor: Option<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>,
    /** **The agent location when the event occurred**

 Where the agent location is known, the agent location when 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 the agent participation in the event**

 Where the policy(ies) are known that authorized the agent participation in the event. 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>>,
    /** **This agent network location for the activity**

 When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.

 When remote network endpoint is known, another agent representing the remote agent would indicate the remote network endpoint used. Convention is to indicate data flowing from Source to Destination. The convention for Search, given data flows both ways (query parameters vs results), is to have the Source as the initiator of the Search Transaction, and the Destination the responder to the Search transaction. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub network: Option<AuditEventAgentNetwork>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub network_ext: Option<AuditEventAgentNetworkExtension>,
    /** **[AuditPurposeOfUse](http://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Allowable authorization for this agent**

 The authorization (e.g., PurposeOfUse) that was used during the event being recorded.

 Use AuditEvent.agent.authorization when you know that is specific to the agent, otherwise use AuditEvent.authorization. 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 = "authorization")]
    pub authorization: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authorization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authorization_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AuditEventAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventAgentBuilder {
        AuditEventAgentBuilder::default()
    }
}
/// Choice of types for the network[x] field in AuditEventAgent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventAgentNetwork {
    /// Variant accepting the Reference type.
    #[serde(rename = "networkReference")]
    Reference(Reference),
    /// Variant accepting the Uri type.
    #[serde(rename = "networkUri")]
    Uri(String),
    /// Variant accepting the String type.
    #[serde(rename = "networkString")]
    String(String),
}
/// Extension value for AuditEventAgentNetwork.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventAgentNetworkExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_networkReference")]
    Reference(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_networkUri")]
    Uri(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_networkString")]
    String(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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<Reference>,
    /// 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 = "observer")]
    pub observer: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observer_ext: Option<FieldExtension>,
    /** **[AuditEventSourceType](http://hl7.org/fhir/ValueSet/security-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<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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 resource**

 Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.

 Use .what.display when all you have is a string (e.g. ParticipantObjectName). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "what")]
    pub what: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_what")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub what_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<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>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-label-examples); 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<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>>,
    /** **Query parameters**

 The query parameters for a query-type entities.

 The meaning and secondary-encoding of the content of base64 encoded blob is specific to the AuditEvent.type, AuditEvent.subtype, and AuditEvent.entity.role.  The base64 is a general-use and safe container for event specific data blobs regardless of the encoding used by the transaction being recorded.  An AuditEvent consuming application must understand the event it is consuming and the formats used by the event. For example, if auditing an Oracle network database access, the Oracle formats must be understood as they will be simply encoded in the base64binary blob.

The DICOM AuditMessage schema does not support both .name and .query being populated. */
    #[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>>,
    /** **Entity is attributed to this agent**

 The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent.

 A usecase where one AuditEvent.entity.agent is used where the Entity that was used in the creation/updating of a target resource, is not in the context of the same custodianship as the target resource, and thus the meaning of AuditEvent.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 AuditEvent 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<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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The type of extra detail provided in the value.

 */
    #[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>,
    /** **Property value**

 The  value of the extra detail.

 */
    #[serde(flatten)]
    pub value: AuditEventEntityDetailValue,
    /// 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<AuditEventEntityDetailValueExtension>,
}
#[cfg(feature = "builders")]
impl AuditEventEntityDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventEntityDetailBuilder {
        AuditEventEntityDetailBuilder::default()
    }
}
/// Choice of types for the value[x] field in AuditEventEntityDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventEntityDetailValue {
    /// 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 Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// 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),
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
}
/// Extension value for AuditEventEntityDetailValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AuditEventEntityDetailValueExtension {
    /// 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 Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(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),
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
}
/** 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.

 **[Basic](http://hl7.org/fhir/StructureDefinition/Basic) v5.0.0**

 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>);
/** 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.

 **[Basic](http://hl7.org/fhir/StructureDefinition/Basic) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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<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 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
    }
}
/** A resource that represents the data of a single raw artifact as digital content accessible in its native format.  A Binary resource can contain any content, whether text, image, pdf, zip archive, etc.

 **[Binary](http://hl7.org/fhir/StructureDefinition/Binary) v5.0.0**

 Pure binary content defined by a format other than FHIR

 A resource that represents the data of a single raw artifact as digital content accessible in its native format.  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. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Binary(pub Box<BinaryInner>);
/** A resource that represents the data of a single raw artifact as digital content accessible in its native format.  A Binary resource can contain any content, whether text, image, pdf, zip archive, etc.

 **[Binary](http://hl7.org/fhir/StructureDefinition/Binary) v5.0.0**

 Pure binary content defined by a format other than FHIR

 A resource that represents the data of a single raw artifact as digital content accessible in its native format.  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. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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://hl7.org/fhir/ValueSet/mimetypes); 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>,
    /** **Identifies another resource to use as proxy when enforcing access control**

 This element identifies another resource that can be used as a proxy of the security sensitivity to use when deciding and enforcing access control rules for the Binary resource. Given that the Binary resource contains very few elements that can be used to determine the sensitivity of the data and relationships to individuals, the referenced resource stands in as a proxy equivalent for this purpose. This referenced resource may be related to the Binary (e.g. DocumentReference), or may be some non-related Resource purely as a security proxy. E.g. to identify that the binary resource relates to a patient, and access should only be granted to applications that have access to the patient.

 Very often, a server will also know of a resource that references the binary, and can automatically apply the appropriate access rules based on that reference. However, there are some circumstances where this is not appropriate, e.g. the binary is uploaded directly to the server without any linking resource, the binary is referred to from multiple different resources, and/or the binary is content such as an application logo that has less protection than any of the resources that reference it. */
    #[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(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "data")]
    pub data: Option<Base64Binary>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_data")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_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
    }
}
/** A biological material originating from a biological entity intended to be transplanted or infused into another (possibly the same) biological entity.

 **[BiologicallyDerivedProduct](http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct) v5.0.0**

 This resource reflects an instance of a biologically derived product

 This resource reflects an instance of a biologically derived product. A material substance originating from a biological entity intended to be transplanted or infused
into another (possibly the same) biological entity.

 Substances include, but are not limited to: whole blood, bone marrow, organs, and manipulated blood cells. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct BiologicallyDerivedProduct(pub Box<BiologicallyDerivedProductInner>);
/** A biological material originating from a biological entity intended to be transplanted or infused into another (possibly the same) biological entity.

 **[BiologicallyDerivedProduct](http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct) v5.0.0**

 This resource reflects an instance of a biologically derived product

 This resource reflects an instance of a biologically derived product. A material substance originating from a biological entity intended to be transplanted or infused
into another (possibly the same) biological entity.

 Substances include, but are not limited to: whole blood, bone marrow, organs, and manipulated blood cells. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BiologicallyDerivedProductBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BiologicallyDerivedProductInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "BiologicallyDerivedProduct::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::BiologicallyDerivedProduct", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Broad category of this product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productCategory")]
    pub product_category: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_category_ext: Option<FieldExtension>,
    /** **[BiologicallyDerivedProductCodes](http://hl7.org/fhir/ValueSet/biologicallyderived-productcodes); A code that identifies the kind of this biologically derived product**

 A codified value that systematically supports characterization and classification of medical products of human origin inclusive of processing conditions such as additives, volumes and handling conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productCode")]
    pub product_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_code_ext: Option<FieldExtension>,
    /** **The parent biologically-derived product**

 Parent product (if any) for this biologically-derived product.

 For products that have multiple collections. For example Peripheral Blood Stem Cells may be collected over several days from a single donor and the donation split into in multiple containers which must be linked to the parent donation. */
    #[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>>,
    /** **Request to obtain and/or infuse this product**

 Request to obtain and/or infuse this biologically derived product.

 */
    #[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>>,
    /** **Instance identifier**

 Unique instance identifiers assigned to a biologically derived product. Note: This is a business identifier, not a resource identifier.

 This identifier should uniquely identify the product instance in the business domain.  Ideally it should be a globally unique identifier under the control of an ISO/IEC 15459 Issuing Agency. */
    #[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>>,
    /** **An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled**

 An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.

 Necessary to support mandatory requirements for traceability from donor/source to recipient and vice versa, while also satisfying donor anonymity requirements. The element is defined consistently across BiologicallyDerivedProduct, NutritionProduct, and Device.  The identifier references an event that links to a single biological entity such as a blood donor, or to multiple biological entities (e.g. when the product is an embryo or a pooled platelet product).  A single biologicalSourceEvent identifier may appear on multiple products of many types derived from a single donation event or source extraction.  As an example, a single donation event may provide 2 kidneys and a liver for organ transplantation, 2 corneas for eye surgery, heart valves and arterial tissue for cardiovascular surgery, multiple skin grafts, tendons, multiple shaped bone grafts and a large number of bone putty/paste products; and each of them may be assigned to the same biological source event identifier. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "biologicalSourceEvent")]
    pub biological_source_event: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_biologicalSourceEvent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub biological_source_event_ext: Option<FieldExtension>,
    /** **Processing facilities responsible for the labeling and distribution of this biologically derived product**

 Processing facilities responsible for the labeling and distribution of this biologically derived product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processingFacility")]
    pub processing_facility: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processingFacility")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub processing_facility_ext: Vec<Option<FieldExtension>>,
    /** **A unique identifier for an aliquot of a product**

 A unique identifier for an aliquot of a product.  Used to distinguish individual aliquots of a product carrying the same biologicalSource and productCode identifiers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "division")]
    pub division: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_division")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub division_ext: Option<FieldExtension>,
    /** **[BiologicallyDerivedProductStatus](http://hl7.org/fhir/ValueSet/biologicallyderived-product-status); available | unavailable**

 Whether the product is currently available.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productStatus")]
    pub product_status: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_status_ext: Option<FieldExtension>,
    /** **Date, and where relevant time, of expiration**

 Date, and where relevant time, of expiration.

 */
    #[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>,
    /** **How this product was collected**

 How this product was collected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "collection")]
    pub collection: Option<BiologicallyDerivedProductCollection>,
    /// 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>,
    /** **Product storage temperature requirements**

 The temperature requirements for storage of the biologically-derived product.

 May be extracted from information held in the Product Description Code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "storageTempRequirements")]
    pub storage_temp_requirements: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_storageTempRequirements")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub storage_temp_requirements_ext: Option<FieldExtension>,
    /** **A property that is specific to this BiologicallyDerviedProduct instance**

 A property that is specific to this BiologicallyDerviedProduct instance.

 Property can be used to provide information on a wide range of additional information specific to a particular biologicallyDerivedProduct. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<BiologicallyDerivedProductProperty>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl BiologicallyDerivedProductBuilder {
    #[doc = concat!("Finalize building ", "BiologicallyDerivedProduct", ".")]
    pub fn build(
        self,
    ) -> Result<BiologicallyDerivedProduct, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BiologicallyDerivedProductInner> for BiologicallyDerivedProduct {
    fn from(inner: BiologicallyDerivedProductInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for BiologicallyDerivedProduct {
    type Target = BiologicallyDerivedProductInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for BiologicallyDerivedProduct {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl BiologicallyDerivedProduct {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BiologicallyDerivedProductBuilder {
        BiologicallyDerivedProductBuilder::default()
    }
}
impl BiologicallyDerivedProduct {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::BiologicallyDerivedProduct
    }
}
/// Sub-fields of the collection field in BiologicallyDerivedProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BiologicallyDerivedProductCollectionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BiologicallyDerivedProductCollection {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 performing collection**

 Healthcare professional who is performing the collection.

 */
    #[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>,
    /** **The patient who underwent the medical procedure to collect the product or the organization that facilitated the collection**

 The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.

 */
    #[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>,
    /** **Time of product collection**

 Time of product collection.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub collected: Option<BiologicallyDerivedProductCollectionCollected>,
    /// 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<BiologicallyDerivedProductCollectionCollectedExtension>,
}
#[cfg(feature = "builders")]
impl BiologicallyDerivedProductCollection {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BiologicallyDerivedProductCollectionBuilder {
        BiologicallyDerivedProductCollectionBuilder::default()
    }
}
/// Choice of types for the collected[x] field in BiologicallyDerivedProductCollection
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum BiologicallyDerivedProductCollectionCollected {
    /// Variant accepting the DateTime type.
    #[serde(rename = "collectedDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "collectedPeriod")]
    Period(Period),
}
/// Extension value for BiologicallyDerivedProductCollectionCollected.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum BiologicallyDerivedProductCollectionCollectedExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_collectedDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_collectedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the property field in BiologicallyDerivedProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BiologicallyDerivedProductPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BiologicallyDerivedProductProperty {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Code that specifies the property. It should reference an established coding system.

 The element is identified by name and system URI in the type. Some types may have multiple occurrences. */
    #[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>,
    /** **Property values**

 Property values.

 The value should be provided as a boolean, integer, CodeableConcept, period, quantity, range, ratio, or attachment. The description can be a string only when these others are not available. The type of value will depend on the property type and is specified in ST-027. */
    #[serde(flatten)]
    pub value: BiologicallyDerivedProductPropertyValue,
    /// 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<BiologicallyDerivedProductPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl BiologicallyDerivedProductProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BiologicallyDerivedProductPropertyBuilder {
        BiologicallyDerivedProductPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in BiologicallyDerivedProductProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum BiologicallyDerivedProductPropertyValue {
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// 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 String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for BiologicallyDerivedProductPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum BiologicallyDerivedProductPropertyValueExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(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 String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/** A record of dispensation of a biologically derived product.

 **[BiologicallyDerivedProductDispense](http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProductDispense) v5.0.0**

 A record of dispensation of a biologically derived product

 This resource reflects an instance of a biologically derived product dispense. The supply or dispense of a biologically derived product from the supply organization or department (e.g. hospital transfusion laboratory) to the clinical team responsible for clinical application.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct BiologicallyDerivedProductDispense(
    pub Box<BiologicallyDerivedProductDispenseInner>,
);
/** A record of dispensation of a biologically derived product.

 **[BiologicallyDerivedProductDispense](http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProductDispense) v5.0.0**

 A record of dispensation of a biologically derived product

 This resource reflects an instance of a biologically derived product dispense. The supply or dispense of a biologically derived product from the supply organization or department (e.g. hospital transfusion laboratory) to the clinical team responsible for clinical application.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BiologicallyDerivedProductDispenseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BiologicallyDerivedProductDispenseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "BiologicallyDerivedProductDispense::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(
            default = "ResourceType::BiologicallyDerivedProductDispense",
            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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this dispense**

 Unique instance identifiers assigned to a biologically derived product dispense. Note: This is a business identifier, not a resource 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>>,
    /** **The order or request that this dispense is fulfilling**

 The order or request that the dispense is fulfilling. This is a reference to a ServiceRequest resource.

 */
    #[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>>,
    /** **Short description**

 A larger event of which this particular event is a component.

 */
    #[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>>,
    /** **[BiologicallyDerivedProductDispenseStatus](http://hl7.org/fhir/ValueSet/biologicallyderivedproductdispense-status); preparation | in-progress | allocated | issued | unfulfilled | returned | entered-in-error | unknown**

 A code specifying the state of the dispense event.

 */
    #[serde(rename = "status")]
    pub status: codes::BiologicallyDerivedProductDispense,
    /// 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>,
    /** **[BiologicallyDerivedProductDispenseOriginRelationship](http://hl7.org/fhir/ValueSet/biologicallyderivedproductdispense-origin-relationship); Relationship between the donor and intended recipient**

 Indicates the relationship between the donor of the biologically derived product and the intended recipient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "originRelationshipType")]
    pub origin_relationship_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_originRelationshipType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub origin_relationship_type_ext: Option<FieldExtension>,
    /** **The BiologicallyDerivedProduct that is dispensed**

 A link to a resource identifying the biologically derived product that is being dispensed.

 */
    #[serde(rename = "product")]
    pub product: Reference,
    /// 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>,
    /** **The intended recipient of the dispensed product**

 A link to a resource representing the patient that the product is dispensed 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>,
    /** **[BiologicallyDerivedProductDispenseMatchStatus](http://hl7.org/fhir/ValueSet/biologicallyderivedproductdispense-match-status); Indicates the type of matching associated with the dispense**

 Indicates the type of matching associated with the dispense.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "matchStatus")]
    pub match_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_matchStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub match_status_ext: Option<FieldExtension>,
    /** **Indicates who or what performed an action**

 Indicates who or what performed an action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<BiologicallyDerivedProductDispensePerformer>>,
    /// 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 dispense occurred**

 The physical location where the dispense was performed.

 */
    #[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>,
    /** **Amount dispensed**

 The amount of product in the dispense. Quantity will depend on the product being dispensed. Examples are: volume; cell count; concentration.

 */
    #[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>,
    /** **When product was selected/matched**

 When the product was selected/ matched.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preparedDate")]
    pub prepared_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preparedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prepared_date_ext: Option<FieldExtension>,
    /** **When the product was dispatched**

 When the product was dispatched for clinical use.

 */
    #[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 product was dispatched to**

 Link to a resource identifying the physical location that the product was dispatched to.

 */
    #[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>,
    /** **Additional notes**

 Additional 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>>,
    /** **Specific instructions for use**

 Specific instructions for use.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usageInstruction")]
    pub usage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_instruction_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BiologicallyDerivedProductDispenseBuilder {
    #[doc = concat!("Finalize building ", "BiologicallyDerivedProductDispense", ".")]
    pub fn build(
        self,
    ) -> Result<BiologicallyDerivedProductDispense, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BiologicallyDerivedProductDispenseInner>
for BiologicallyDerivedProductDispense {
    fn from(inner: BiologicallyDerivedProductDispenseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for BiologicallyDerivedProductDispense {
    type Target = BiologicallyDerivedProductDispenseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for BiologicallyDerivedProductDispense {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl BiologicallyDerivedProductDispense {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BiologicallyDerivedProductDispenseBuilder {
        BiologicallyDerivedProductDispenseBuilder::default()
    }
}
impl BiologicallyDerivedProductDispense {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::BiologicallyDerivedProductDispense
    }
}
/// Sub-fields of the performer field in BiologicallyDerivedProductDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BiologicallyDerivedProductDispensePerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BiologicallyDerivedProductDispensePerformer {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Identifies the function of the performer during the dispense.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who performed the action**

 Identifies the person responsible for 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 BiologicallyDerivedProductDispensePerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BiologicallyDerivedProductDispensePerformerBuilder {
        BiologicallyDerivedProductDispensePerformerBuilder::default()
    }
}
/** Record details about an anatomical structure.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.

 **[BodyStructure](http://hl7.org/fhir/StructureDefinition/BodyStructure) v5.0.0**

 Specific and identified anatomical structure

 Record details about an anatomical structure.  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 BodyStructure(pub Box<BodyStructureInner>);
/** Record details about an anatomical structure.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.

 **[BodyStructure](http://hl7.org/fhir/StructureDefinition/BodyStructure) v5.0.0**

 Specific and identified anatomical structure

 Record details about an anatomical structure.  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 = "BodyStructureBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BodyStructureInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "BodyStructure::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::BodyStructure", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Identifier for this instance of the anatomical structure.

 */
    #[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 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>,
    /** **[BodyStructureCode](http://hl7.org/fhir/ValueSet/bodystructure-code); Kind of Structure**

 The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.

 The minimum cardinality of 0 supports the use case of specifying a location without defining a morphology. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "morphology")]
    pub morphology: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_morphology")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub morphology_ext: Option<FieldExtension>,
    /** **Included anatomic location(s)**

 The anatomical location(s) or region(s) of the specimen, lesion, or body structure.

 */
    #[serde(rename = "includedStructure")]
    pub included_structure: Vec<Option<BodyStructureIncludedStructure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_includedStructure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub included_structure_ext: Vec<Option<FieldExtension>>,
    /** **Excluded anatomic locations(s)**

 The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludedStructure")]
    pub excluded_structure: Vec<Option<BodyStructureIncludedStructure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_excludedStructure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub excluded_structure_ext: Vec<Option<FieldExtension>>,
    /** **Text description**

 A summary, characterization or explanation of the body structure.

 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 BodyStructureBuilder {
    #[doc = concat!("Finalize building ", "BodyStructure", ".")]
    pub fn build(self) -> Result<BodyStructure, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BodyStructureInner> for BodyStructure {
    fn from(inner: BodyStructureInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for BodyStructure {
    type Target = BodyStructureInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for BodyStructure {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl BodyStructure {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BodyStructureBuilder {
        BodyStructureBuilder::default()
    }
}
impl BodyStructure {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::BodyStructure
    }
}
/// Sub-fields of the includedStructure field in BodyStructure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BodyStructureIncludedStructureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BodyStructureIncludedStructure {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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](http://hl7.org/fhir/ValueSet/body-site); Code that represents the included structure**

 Code that represents the included structure.

 */
    #[serde(rename = "structure")]
    pub structure: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_structure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub structure_ext: Option<FieldExtension>,
    /** **[BodyStructureQualifier](http://hl7.org/fhir/ValueSet/bodystructure-relative-location); Code that represents the included structure laterality**

 Code that represents the included structure laterality.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "laterality")]
    pub laterality: Option<CodeableConcept>,
    /// 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>,
    /** **Landmark relative location**

 Body locations in relation to a specific body landmark (tatoo, scar, other body structure).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodyLandmarkOrientation")]
    pub body_landmark_orientation: Vec<
        Option<BodyStructureIncludedStructureBodyLandmarkOrientation>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodyLandmarkOrientation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub body_landmark_orientation_ext: Vec<Option<FieldExtension>>,
    /** **Cartesian reference for structure**

 XY or XYZ-coordinate orientation for structure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "spatialReference")]
    pub spatial_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_spatialReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub spatial_reference_ext: Vec<Option<FieldExtension>>,
    /** **[BodyStructureQualifier](http://hl7.org/fhir/ValueSet/bodystructure-relative-location); Code that represents the included structure qualifier**

 Code that represents the included structure qualifier.

 */
    #[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>>,
}
#[cfg(feature = "builders")]
impl BodyStructureIncludedStructure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BodyStructureIncludedStructureBuilder {
        BodyStructureIncludedStructureBuilder::default()
    }
}
/// Sub-fields of the bodyLandmarkOrientation field in BodyStructureIncludedStructure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BodyStructureIncludedStructureBodyLandmarkOrientationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BodyStructureIncludedStructureBodyLandmarkOrientation {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A description of a landmark on the body used as a reference to locate something else.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "landmarkDescription")]
    pub landmark_description: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_landmarkDescription")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub landmark_description_ext: Vec<Option<FieldExtension>>,
    /** **[bodyLandmarkOrientationClockFacePosition](http://hl7.org/fhir/ValueSet/bodystructure-bodylandmarkorientation-clockface-position); Clockface orientation**

 An description of the direction away from a landmark something is located based on a radial clock dial.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clockFacePosition")]
    pub clock_face_position: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_clockFacePosition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub clock_face_position_ext: Vec<Option<FieldExtension>>,
    /** **Landmark relative location**

 The distance in centimeters a certain observation is made from a body landmark.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "distanceFromLandmark")]
    pub distance_from_landmark: Vec<
        Option<BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmark>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_distanceFromLandmark")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub distance_from_landmark_ext: Vec<Option<FieldExtension>>,
    /** **[bodyLandmarkOrientationSurfaceOrientation](http://hl7.org/fhir/ValueSet/bodystructure-relative-location); Relative landmark surface orientation**

 The surface area a body location is in relation to a landmark.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "surfaceOrientation")]
    pub surface_orientation: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_surfaceOrientation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub surface_orientation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl BodyStructureIncludedStructureBodyLandmarkOrientation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BodyStructureIncludedStructureBodyLandmarkOrientationBuilder {
        BodyStructureIncludedStructureBodyLandmarkOrientationBuilder::default()
    }
}
/// Sub-fields of the distanceFromLandmark field in BodyStructureIncludedStructureBodyLandmarkOrientation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmark {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 An instrument, tool, analyzer, etc. used in the measurement.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Measured distance from body landmark**

 The measured distance (e.g., in cm) from a body landmark.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmark {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkBuilder {
        BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkBuilder::default()
    }
}
/** A container for a collection of resources.

 **[Bundle](http://hl7.org/fhir/StructureDefinition/Bundle) v5.0.0**

 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>);
/** A container for a collection of resources.

 **[Bundle](http://hl7.org/fhir/StructureDefinition/Bundle) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 bundle that won't change as a bundle 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 | subscription-notification**

 Indicates the purpose of this bundle - how it is 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>,
    /** **When the bundle was assembled**

 The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.

 For many bundles, the timestamp is equal to .meta.lastUpdated, because they are not stored (e.g. search results). When a bundle is placed in a persistent store, .meta.lastUpdated will be usually be changed by the server. When the bundle is a message, a middleware agent altering the message (even if not stored) SHOULD update .meta.lastUpdated. .timestamp is used to track the original time of the Bundle, and SHOULD be populated.

Usage:

* document : the date the document was created. Note: the composition may predate the document, or be associated with multiple documents. The date of the composition - the authoring time - may be earlier than the document assembly time
* message : the date that the content of the message was assembled. This date is not changed by middleware engines unless they add additional data that changes the meaning of the time of the message
* history : the date that the history was assembled. This time would be used as the _since time to ask for subsequent updates
* searchset : the time that the search set was assembled. Note that different pages MAY have different timestamps but need not. Having different timestamps does not imply that subsequent pages will represent or include changes made since the initial query
* transaction | transaction-response | batch | batch-response | collection : no particular assigned meaning

The timestamp value should be greater than the lastUpdated and other timestamps in the resources in the bundle, and it should be equal or earlier than the .meta.lastUpdated on the Bundle itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timestamp")]
    pub timestamp: Option<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>,
    /** **If search, the total number of matches**

 If a set of search matches, this is the (potentially estimated) total number of entries of type 'match' across all pages in the search.  It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the 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.

 Both Bundle.link and Bundle.entry.link are defined to support providing additional context when Bundles are used (e.g. [HATEOAS](http://en.wikipedia.org/wiki/HATEOAS)).

Bundle.entry.link corresponds to links found in the HTTP header if the resource in the entry was [read](http.html#read) directly.

This specification defines some specific uses of Bundle.link for [searching](search.html#conformance) and [paging](http.html#paging), but no specific uses for Bundle.entry.link, and no defined function in a transaction - the meaning is implementation specific.  The behavior of navigation link types (next/prev/first/last) are well defined for searchset and history Bundles but are not currently defined for other types. Implementers who choose to use such link relationships for other bundle types will need to negotiate behavior with their interoperability partners. */
    #[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 JWS.

 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>,
    /** **Issues with the Bundle**

 Captures issues and warnings that relate to the construction of the Bundle and the content within it.

 Usage notes: These issues and warnings must apply to the Bundle as a whole, not to individual entries.Messages relating to the processing of individual entries (e.g. in a batch or transaction) SHALL be reported in the entry.response.outcome for that entry.  If there are errors that arise in the creation of the Bundle, then that should be handled by an OperationOutcome being returned instead of the Bundle. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issues")]
    pub issues: Option<Resource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issues")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issues_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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[LinkRelationTypes](http://hl7.org/fhir/ValueSet/iana-link-relations); 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: codes::LinkRelationTypes,
    /// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **URI for resource (e.g. the absolute URL server address, URI for UUID/OID, etc.)**

 The Absolute URL for the resource. Except for transactions and batches, each entry in a Bundle must have a fullUrl. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. Even when not required, fullUrl MAY be set to a urn:uuid to allow referencing entries in a transaction. The fullUrl can be an arbitrary URI and is not limited to urn:uuid, urn:oid, http, and https. The fullUrl element SHALL have a value except when:
* invoking a create
* invoking or responding to an operation where the body is not a single identified resource
* invoking or returning the results of a search or history operation.

 fullUrl might 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 fullURL might be a URN or an absolute URL that does not end with the logical id of the resource (Resource.id). However, but if the fullUrl does look like a RESTful server URL (e.g. meets the [regex](references.html#regex), then the 'id' portion of the fullUrl SHALL end with the Resource.id.

Note that the fullUrl is not the same as the canonical URL - it's an absolute url for an endpoint serving the resource (these will happen to have the same value on the canonical server for the resource with the canonical URL). */
    #[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 Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type. This is allowed to be a Parameters resource if and only if it is referenced by something else within the Bundle that provides context/meaning.

 */
    #[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>,
    /** **Additional execution information (transaction/batch/history)**

 Additional information about how this entry should be processed as part of a transaction or batch.  For history, it shows how the entry was processed to create the version contained in the entry.

 */
    #[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>,
    /** **Results of execution (transaction/batch/history)**

 Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 - 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, or to convey information or warning information about the search process.

 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.

See [Patient Match](patient-operation-match.html) for the EMPI search which relates to this element. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | HEAD | POST | PUT | DELETE | PATCH**

 In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.

 */
    #[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 validation**

 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 cache currency**

 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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, populated if the operation returns a location.

 */
    #[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, if 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 (meta.lastUpdated) 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.

This outcome is not used for error responses in batch/transaction, only for hints and warnings. In a batch operation, the error will be in Bundle.entry.response, and for transaction, there will be a single OperationOutcome instead of a bundle in the case of an error. */
    #[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()
    }
}
/** A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server or Client for a particular version of FHIR that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 **[CapabilityStatement](http://hl7.org/fhir/StructureDefinition/CapabilityStatement) v5.0.0**

 A statement of system capabilities

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

 Applications may implement multiple versions (see [Managing Multiple Versions](versioning.html), and the [$versions](capabilitystatement-operation-versions.html) operation). If they do, then a CapabilityStatement describes the system's support for a particular version of FHIR, and the server will have multiple statements, one for each version. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CapabilityStatement(pub Box<CapabilityStatementInner>);
/** A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server or Client for a particular version of FHIR that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 **[CapabilityStatement](http://hl7.org/fhir/StructureDefinition/CapabilityStatement) v5.0.0**

 A statement of system capabilities

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

 Applications may implement multiple versions (see [Managing Multiple Versions](versioning.html), and the [$versions](capabilitystatement-operation-versions.html) operation). If they do, then a CapabilityStatement describes the system's support for a particular version of FHIR, and the server will have multiple statements, one for each version. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this capability statement, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this capability statement is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the capability statement is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 CapabilityStatement (business identifier)**

 A formal identifier that is used to identify this CapabilityStatement when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **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 reference to a particular business version of the capability statement with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<CapabilityStatementVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<CapabilityStatementVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 versus not.This is not intended for use with actual capability statements, but where capability statements are used to describe possible or desired systems.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 statements that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the capability statement was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 capability statement is presumed to be the predominant language in the place the capability statement 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate capability statement instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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. This capability statement is a published API description that corresponds to a business service. The server may actually implement a subset of the capability statement it claims to implement, so the capability statement must specify the full capability details.

 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>>,
    /** **Canonical URL of another capability statement this adds to**

 Reference to a canonical URL of another CapabilityStatement that this software adds to. The capability statement automatically includes everything in the other statement, and it is not duplicated, though the server may repeat the same resources, interactions and operations to add additional details to them.

 the contents of any directly or indirectly imported CapabilityStatements SHALL NOT overlap, i.e. they cannot refer to the same rest/resource, operations/name, searchparam/name, interaction/code, messaging/endpoint, document/mode pair.

A capability statement that imports another CapabilityStatement automatically instantiates it too (though this is often not a very useful statement for the kinds of CapabilityStatements that are suitable for importing). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "imports")]
    pub imports: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_imports")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub imports_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>,
    /** **[FHIRVersion](http://hl7.org/fhir/ValueSet/FHIR-version); FHIR Version the system supports**

 The version of the FHIR specification that this CapabilityStatement describes (which SHALL be the same as the FHIR version of the CapabilityStatement itself). There is no default value.

 Servers may implement multiple versions (see [Managing Multiple Versions](versioning.html), and the [$versions](capabilitystatement-operation-versions.html) operation). If they do, and the CapabilityStatement is requested from the server, then this fhirVersion will be either the version requested, or the server's default version. */
    #[serde(rename = "fhirVersion")]
    pub fhir_version: codes::FHIRVersion,
    /// 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>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); 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://hl7.org/fhir/ValueSet/mimetypes); 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>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/all-languages); Languages supported**

 A list of the languages supported by this implementation that are usefully supported in the ```textAccept-Language``` header.

 In general, if a server gets a request with an Accept-Language that it doesn't support, it should still reutrn the resource, just in its default language for the resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "acceptLanguage")]
    pub accept_language: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_acceptLanguage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub accept_language_ext: Vec<Option<FieldExtension>>,
    /** **Implementation guides supported**

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

 Note: this is primarily only relevant in terms of ImplementationGuides that don't define specific CapabilityStatements declaring the expectation of distinct roles.  (E.g. generic IGs that establish privacy policies.)  In situations where an ImplementationGuide does define CapabilityStatements, asserting CapabilityStatement.implementationGuide means that the implementation adheres to any Implementation.global definitions present in that IG as well as any textual requirements around security or other general interoperability behaviors. However, it does not make any assertions as to conformance with any of the CapabilityStatements defined in the IG. To assert conformance with CapabilityStatements in a referenced IG, it is necessary to use the CapabilityStatement.instantiates element. */
    #[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>>,
    /** **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
    }
}
/// Choice of types for the versionAlgorithm[x] field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CapabilityStatementVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for CapabilityStatementVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CapabilityStatementVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the 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 was 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Organization that manages the data**

 The organization responsible for the management of the instance and oversight of the data on the server at the specified URL.

 */
    #[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>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. This is only for searches executed against the system-level endpoint.

 Typically, the only search parameters supported for all searches are those that apply to all resources - tags, profiles, text search etc. These search parameters should include the control search parameters such as _sort, _count, etc. that also apply to this resource (though many will be listed at [CapabilityStatement.rest.searchParam](capabilitystatement-definitions.html#CapabilityStatement.rest.searchParam)). The behavior of some search parameters may be further described by other code or extension elements, or narrative within the capability statement or linked [SearchParameter](searchparameter.html#) definitions. */
    #[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 a system level operation**

 Definition of an operation or a named query together with its parameters and their meaning and type.

 CapabilityStatement.rest.operation is for operations invoked at the system level, or for operations that are supported across multiple resource types. Operations linked from CapabilityStatement.rest.operation must have OperationDefinition.system = true, or more than one Operation.resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Vec<Option<CapabilityStatementRestResourceOperation>>,
    /// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestSecurity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestSecurityBuilder {
        CapabilityStatementRestSecurityBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
    /** **System-wide profile**

 A system-wide profile that is applied across *all* instances of the resource supported by the system. For example, if declared on Observation, this profile is the "superset" of capabilities for laboratory *and* vitals *and* other domains. See further discussion in [Using Profiles](profiling.html#profile-uses).

 All other profiles for this type that are listed in `.rest.resource.supportedProfile` must conform to this profile. */
    #[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>,
    /** **Use-case specific profiles**

 A list of profiles representing different use cases the system hosts/produces. A supported profile is a statement about the functionality of the data and services provided by the server (or the client) for supported use cases. For example, a system can define and declare multiple Observation profiles for laboratory observations, vital sign observations, etc. By declaring supported profiles, systems provide a way to determine whether individual resources are conformant. See further discussion in [Using Profiles](profiling.html#profile-uses).

 Supported profiles must conform to the resource profile in the `.rest.resource.profile` element if it is present. The resource profile is a system-wide profile applied across *all* instances of the resource supported by the system. A supported profile is a statement about the functionality of the data and services provided by the server (or used by the client) for a particular set of use cases and will not necessarily apply to all data consumed or exposed by the server. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportedProfile")]
    pub supported_profile: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportedProfile")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supported_profile_ext: Vec<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.

 In general, a Resource will only appear in a CapabilityStatement if the server actually has some capabilities - e.g. there is at least one interaction supported. However interactions can be omitted to support summarization (_summary = true). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[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 (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>,
    /** **If allows/uses conditional patch**

 A flag that indicates that the server supports conditional patch.

 Conditional Patch 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 = "conditionalPatch")]
    pub conditional_patch: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionalPatch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditional_patch_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.

 Documenting [`_include`](http://hl7.org/fhir/R5/search.html#revinclude) support helps set conformance expectations for the desired system. Still, it is a level of detail that might not be exposed by production servers or clients when using CapabilityStatement to describe an actual implementation. If this list is empty, the server does not support includes. Support for *iterative* (a.k.a., recursive) `_include` is communicated by listing the iterative includes values supported by the server in the `searchInclude` element of the "root" resource type. For example, to support the following search:

`GET [base]/CarePlan?_include=CarePlan:activity-reference:DeviceRequest&_include:iterate=DeviceRequest:device`

These values would be listed as part of capabilities for "CarePlan":

"searchInclude" : ["CarePlan:activity-reference:DeviceRequest","DeviceRequest:device"],
 */
    #[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.

 See `CapabilityStatement.rest.resource.searchInclude` comments. */
    #[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.

 The search parameters should include the control search parameters such as _sort, _count, etc. that also apply to this resource (though many will be listed at [CapabilityStatement.rest.searchParam](capabilitystatement-definitions.html#CapabilityStatement.rest.searchParam)). The behavior of some search parameters may be further described by other code or extension elements, or narrative within the capability statement or linked [SearchParameter](searchparameter.html#) definitions. */
    #[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 a resource operation**

 Definition of an operation or a named query together with its parameters and their meaning and type. Consult the definition of the operation for details about how to invoke the operation, and the parameters.

 Operations linked from CapabilityStatement.rest.resource.operation must have OperationDefinition.type = true or OperationDefinition.instance = true.

If an operation that is listed in multiple CapabilityStatement.rest.resource.operation (e.g. for different resource types), then clients should understand that the operation is only supported on the specified resource types, and that may be a subset of those listed in OperationDefinition.resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Vec<Option<CapabilityStatementRestResourceOperation>>,
    /// 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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 parameter in search url**

 The label used for the search parameter in this particular system's API - i.e. the 'name' portion of the name-value pair that will appear as part of the search URL.  This SHOULD be the same as the SearchParameter.code of the defining SearchParameter.  However, it can sometimes differ if necessary to disambiguate when a server supports multiple SearchParameters that happen to share the same code.

 Parameter names cannot overlap with standard parameter names, and standard parameters cannot be redefined. There is no correspondence whatsoever between CapabilityStatement's searchParam.name and SearchParameter.name - the latter is used as a class name when generating code for the search parameter. */
    #[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](searchparameter-definitions.html#SearchParameter.url)). This element SHALL be populated if the search parameter refers to a SearchParameter defined by the FHIR core specification or externally defined IGs.

 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. This element SHALL be populated if the search parameter refers to a SearchParameter defined by the FHIR core specification or externally defined IGs. */
    #[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 | special**

 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 operation 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 = "CapabilityStatementRestResourceOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestResourceOperation {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 name is prefixed with $ and used in the URL. For a query, this is the name used in the _query parameter when the query is called. This SHOULD be the same as the OperationDefinition.code of the defining OperationDefinition.  However, it can sometimes differ if necessary to disambiguate when a server supports multiple OperationDefinition that happen to share the same code.

 The name here SHOULD be the same as the OperationDefinition.code in the referenced OperationDefinition, unless there is a name clash and the OperationDefinition.code cannot be used. The name does not include the "$" portion that is always included in the URL. There is no correspondence whatsoever between CapabilityStatement's operation.name and OperationDefinition.name - the latter is used as a class name when generating code for the operation. HL7 will never define operations that have conflicting names. */
    #[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. If a server references the base definition of an Operation (i.e. from the specification itself such as ```texthttp://hl7.org/fhir/OperationDefinition/ValueSet-expand```), that means it supports the full capabilities of the operation - e.g. both GET and POST invocation.  If it only supports a subset, it must define its own custom [OperationDefinition](operationdefinition.html#) with a 'base' of the original OperationDefinition.  The custom definition would describe the specific subset of functionality supported.

 This can be used to build an HTML form to invoke the operation, for instance. */
    #[serde(rename = "definition")]
    pub definition: 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>,
    /** **Specific details about operation behavior**

 Documentation that describes anything special about the operation behavior, possibly detailing different behavior for system, type and instance-level invocation of the operation.

 */
    #[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 CapabilityStatementRestResourceOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestResourceOperationBuilder {
        CapabilityStatementRestResourceOperationBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 endpoint. 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementMessagingSupportedMessage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementMessagingSupportedMessageBuilder {
        CapabilityStatementMessagingSupportedMessageBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the resources used in the document**

 A profile on the document Bundle that constrains which resources are present, and their contents.

 The profile is actually on the Bundle. */
    #[serde(rename = "profile")]
    pub profile: 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>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementDocument {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementDocumentBuilder {
        CapabilityStatementDocumentBuilder::default()
    }
}
/** 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.

 **[CarePlan](http://hl7.org/fhir/StructureDefinition/CarePlan) v5.0.0**

 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>);
/** 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.

 **[CarePlan](http://hl7.org/fhir/StructureDefinition/CarePlan) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_ext: Vec<Option<FieldExtension>>,
    /** **Fulfills plan, proposal or order**

 A higher-level request resource (i.e. a plan, proposal or order) 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/request-status); draft | active | on-hold | revoked | completed | entered-in-error | 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::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>,
    /** **[CarePlanIntent](http://hl7.org/fhir/ValueSet/care-plan-intent); proposal | plan | order | option | directive**

 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.
This element is expected to be immutable. E.g. A "proposal" instance should never change to be a "plan" instance or "order" instance. Instead, a new instance 'basedOn' the prior instance should be created with the new 'intent' value. */
    #[serde(rename = "intent")]
    pub intent: String,
    /// 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 axes of categorization and one plan may serve multiple purposes.  In some cases, this may be redundant with references to CarePlan.addresses. */
    #[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 care plan**

 Human-friendly name for the care plan.

 */
    #[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 the 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>,
    /** **The Encounter during which this CarePlan was created**

 The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. CarePlan activities conducted as a result of the care plan may well occur as part of other encounters. */
    #[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>,
    /** **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>,
    /** **Date record was first recorded**

 Represents when this particular CarePlan record was created in the system, which is often a system-generated date.

 */
    #[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 is the designated responsible party**

 When populated, the custodian is responsible for the care plan. The care plan is attributed to the custodian.

 The custodian might or might not be a contributor. */
    #[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>,
    /** **Who provided the content of the care plan**

 Identifies the individual(s), organization or device who provided the contents of the care plan.

 Collaborative care plans may have multiple contributors. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Reference>>,
    /// 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>>,
    /** **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>>,
    /** **[CarePlanAddresses](http://hl7.org/fhir/ValueSet/clinical-findings); Health issues this plan addresses**

 Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.

 Use CarePlan.addresses.concept when a code sufficiently describes the concern (e.g. condition, problem, diagnosis, risk). Use CarePlan.addresses.reference when referencing a resource, which allows more information to be conveyed, such as onset date. CarePlan.addresses.concept and CarePlan.addresses.reference are not meant to be duplicative. For a single concern, either CarePlan.addresses.concept or CarePlan.addresses.reference can be used. CarePlan.addresses.concept may be a summary code, or CarePlan.addresses.reference may be used to reference a very precise definition of the concern using Condition. Both CarePlan.addresses.concept and CarePlan.addresses.reference can be used if they are describing different concerns for the care 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<CodeableReference>>,
    /// 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 comorbidities, recent procedures, limitations, recent assessments, etc.

 Use "concern" to identify specific conditions addressed by the care plan.  supportingInfo can be used to convey one or more Advance Directives or Medical Treatment Consent Directives by referencing Consent or any other request resource with intent = directive. */
    #[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 or has occurred as part of plan**

 Identifies an action that has occurred or is a planned action to occur as part of the plan. For example, a medication to be used, lab tests to perform, self-monitoring that has occurred, 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Identifies the activity that was performed. For example, an activity could be patient education, exercise, or a medication administration. The reference to an "event" resource, such as Procedure or Encounter or Observation, represents the activity that was performed. The requested activity can be conveyed using the CarePlan.activity.plannedActivityReference (a reference to a “request” resource).

 Note that this should not duplicate the activity status (e.g. completed or in progress). The activity performed is independent of the outcome of the related goal(s). For example, if the goal is to achieve a target body weight of 150 lbs and an activity is defined to exercise, then the activity performed could be amount and intensity of exercise performed 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 = "performedActivity")]
    pub performed_activity: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performedActivity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performed_activity_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 that is intended to be part of the care plan**

 The details of the proposed activity represented in a specific resource.

 Standard extension exists ([http://hl7.org/fhir/StructureDefinition/resource-pertainsToGoal](http://hl7.org/fhir/extensions/StructureDefinition-resource-pertainsToGoal.html)) that allows goals to be referenced from any of the referenced resources in CarePlan.activity.plannedActivityReference.
The goal should be visible when the resource referenced by CarePlan.activity.plannedActivityReference is viewed independently 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 = "plannedActivityReference")]
    pub planned_activity_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plannedActivityReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planned_activity_reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CarePlanActivity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CarePlanActivityBuilder {
        CarePlanActivityBuilder::default()
    }
}
/** The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care.

 **[CareTeam](http://hl7.org/fhir/StructureDefinition/CareTeam) v5.0.0**

 Planned participants in the coordination and delivery of care

 The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CareTeam(pub Box<CareTeamInner>);
/** The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care.

 **[CareTeam](http://hl7.org/fhir/StructureDefinition/CareTeam) v5.0.0**

 Planned participants in the coordination and delivery of care

 The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this care team by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[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.

 Use Group for care provision to all members of the group (e.g. group therapy).  Use Patient for care provision to an individual 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>,
    /** **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 = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **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>>,
    /** **A contact detail for the care team (that applies to all members)**

 A central contact detail for the care team (that applies to all members).

 The ContactPoint.use code of home is not appropriate to use. These contacts are not the contact details of individual care team members. */
    #[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>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.  If a participant has multiple roles within the team, then there should be multiple participants. */
    #[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>,
    /** **When the member is generally available within this care team**

 When the member is generally available within this care team.

 This is populated while creating / managing the CareTeam to ensure there is coverage when servicing CarePlan activities from the Schedule. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub coverage: Option<CareTeamParticipantCoverage>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<CareTeamParticipantCoverageExtension>,
}
#[cfg(feature = "builders")]
impl CareTeamParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CareTeamParticipantBuilder {
        CareTeamParticipantBuilder::default()
    }
}
/// Choice of types for the coverage[x] field in CareTeamParticipant
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CareTeamParticipantCoverage {
    /// Variant accepting the Period type.
    #[serde(rename = "coveragePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "coverageTiming")]
    Timing(Timing),
}
/// Extension value for CareTeamParticipantCoverage.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CareTeamParticipantCoverageExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_coveragePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_coverageTiming")]
    Timing(FieldExtension),
}
/** 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.

 **[ChargeItem](http://hl7.org/fhir/StructureDefinition/ChargeItem) v5.0.0**

 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>);
/** 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.

 **[ChargeItem](http://hl7.org/fhir/StructureDefinition/ChargeItem) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 = "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>>,
    /** **Defining information about the code of this charge item**

 References the (external) source of pricing information, rules of application for the code this ChargeItem uses.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionUri")]
    pub definition_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definitionUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_uri_ext: Vec<Option<FieldExtension>>,
    /** **Resource defining the code of this ChargeItem**

 References the source of pricing information, rules of application for the code this ChargeItem uses.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionCanonical")]
    pub definition_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definitionCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_canonical_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 associated with this ChargeItem**

 This ChargeItem has the details of how the associated Encounter should be billed or otherwise be handled by finance systems.

 This ChargeItem may be recorded during planning, execution or after the actual encounter takes place. */
    #[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 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 = "performer")]
    pub performer: Vec<Option<ChargeItemPerformer>>,
    /// 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>>,
    /** **Organization providing the charged service**

 The organization performing 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 requesting the service.

 The rendered Service might not be associated with a Request. This property indicates which Organization requested the services to be 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>,
    /** **Organization that has ownership of the (potential, future) revenue**

 The financial cost center permits the tracking of charge attribution.

 The costCenter could either be given as a reference to an Organization(Role) resource or as the identifier of the cost center determined by Reference.identifier.value and Reference.identifier.system, depending on use case requirements. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "costCenter")]
    pub cost_center: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_costCenter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cost_center_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 [http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extensions/StructureDefinition-bodySite.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>>,
    /** **Unit price overriding the associated rules**

 The unit price of the chargable item.

 This could be communicated in ChargeItemDefinition. But if ChargeItemDefinition is not supported or not available, the unit price can be communicated in this property. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPriceComponent")]
    pub unit_price_component: Option<MonetaryComponent>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPriceComponent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_component_ext: Option<FieldExtension>,
    /** **Total price overriding the associated rules**

 The total price for the chargable item, accounting for the quantity.

  Often, the total price may be be calculated and recorded on the Invoice, but if a calculated total price must be exchanged prior to Invoice creation, it can be communicated in this property. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalPriceComponent")]
    pub total_price_component: Option<MonetaryComponent>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalPriceComponent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_price_component_ext: Option<FieldExtension>,
    /** **[override-reason](); 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.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "overrideReason")]
    pub override_reason: Option<CodeableConcept>,
    /// 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 the person considered responsible for factor/price overrides 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<CodeableReference>>,
    /// 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>>,
    /** **[ChargeItemProduct](http://hl7.org/fhir/ValueSet/device-type); Product charged**

 Identifies the device, food, drug or other product being charged either by type code or reference to an instance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "product")]
    pub product: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Account to place this charge**

 Account into which this ChargeItems belongs.

 Systems posting the ChargeItems might not always be able to determine, which accounts the Items need to be places into. It is up to the postprocessing 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 this charge**

 Further information supporting 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 performer 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 = "ChargeItemPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ChargeItemPerformer {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Describes the type of performance or participation(e.g. primary surgeon, anesthesiologiest, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_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 ChargeItemPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ChargeItemPerformerBuilder {
        ChargeItemPerformerBuilder::default()
    }
}
/** The ChargeItemDefinition resource provides the properties that apply to the (billing) codes necessary to calculate costs and prices. The properties may differ largely depending on type and realm, therefore this resource gives only a rough structure and requires profiling for each type of billing code system.

 **[ChargeItemDefinition](http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) v5.0.0**

 Definition of properties and rules about how the price and the applicability of a ChargeItem can be determined

 The ChargeItemDefinition resource provides the properties that apply to the (billing) codes necessary to calculate costs and prices. The properties may differ largely depending on type and realm, therefore this resource gives only a rough structure and requires profiling for each type of billing code system.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ChargeItemDefinition(pub Box<ChargeItemDefinitionInner>);
/** The ChargeItemDefinition resource provides the properties that apply to the (billing) codes necessary to calculate costs and prices. The properties may differ largely depending on type and realm, therefore this resource gives only a rough structure and requires profiling for each type of billing code system.

 **[ChargeItemDefinition](http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition) v5.0.0**

 Definition of properties and rules about how the price and the applicability of a ChargeItem can be determined

 The ChargeItemDefinition resource provides the properties that apply to the (billing) codes necessary to calculate costs and prices. The properties may differ largely depending on type and realm, therefore this resource gives only a rough structure and requires profiling for each type of billing code system.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ChargeItemDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ChargeItemDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ChargeItemDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ChargeItemDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this charge item definition, represented as a URI (globally unique)**

 An absolute URI that is used to identify this charge item definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this charge item definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the charge item definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 charge item definition**

 A formal identifier that is used to identify this charge item 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, and can then identify this charge item 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 charge item definition**

 The identifier that is used to identify this version of the charge item definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the charge item 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 charge item definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the charge item definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ChargeItemDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ChargeItemDefinitionVersionAlgorithmExtension>,
    /** **Name for this charge item definition (computer friendly)**

 A natural language name identifying the ChargeItemDefinition. 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 alphanumeric type name to ensure that it is machine-processing 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 charge item definition (human friendly)**

 A short, descriptive, user-friendly title for the charge item 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>,
    /** **Underlying externally-defined charge item definition**

 The URL pointing to an externally-defined charge item definition that is adhered to in whole or in part by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFromUri")]
    pub derived_from_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFromUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_uri_ext: Vec<Option<FieldExtension>>,
    /** **A larger definition of which this particular definition is a component or step**

 A larger definition of which this particular definition 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<String>>,
    /// 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>>,
    /** **Completed or terminated request(s) whose function is taken by this new request**

 As new versions of a protocol or guideline are defined, allows identification of what versions are replaced by a new instance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<String>>,
    /// 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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The current state of the ChargeItemDefinition.

 Allows filtering of charge item definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 charge item definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of charge item definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the charge item definition was last significantly changed. The date must change 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 charge item definition changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the charge item definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the charge item definition.

 Usually an organization but may be an individual. The publisher (or steward) of the charge item definition is the organization or individual primarily responsible for the maintenance and upkeep of the charge item 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 charge item 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 charge item definition**

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

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the charge item 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 charge item definition is presumed to be the predominant language in the place the charge item definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate charge item definition instances.

 When multiple useContexts are specified, there is no expectation that 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 charge item definition (if applicable)**

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

 It may be possible for the charge item definition to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 charge item definition is defined**

 Explanation of why this charge item definition is needed and why it has been designed as it has.

 This element does not describe the usage of the charge item 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 charge item 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 charge item definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the charge item 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the charge item 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 charge item definition was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[ChargeItemDefinitionCode](http://hl7.org/fhir/ValueSet/chargeitem-billingcodes); Billing code or product type this definition applies to**

 The defined billing details in this resource pertain to the given billing 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>,
    /** **Instances this definition applies to**

 The defined billing details in this resource pertain to the given product instance(s).

 In case of highly customized, individually produced or fitted devices/substances, the pricing information may be different for each instance of the product. This reference links pricing details to specific product instances. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<Reference>>,
    /// 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>>,
    /** **Whether or not the billing code is applicable**

 Expressions that describe applicability criteria for the billing code.

 The applicability conditions can be used to ascertain whether a billing item is allowed in a specific context. E.g. some billing codes may only be applicable in out-patient settings, only to male/female patients or only to children. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "applicability")]
    pub applicability: Vec<Option<ChargeItemDefinitionApplicability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_applicability")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub applicability_ext: Vec<Option<FieldExtension>>,
    /** **Group of properties which are applicable under the same conditions**

 Group of properties which are applicable under the same conditions. If no applicability rules are established for the group, then all properties always apply.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "propertyGroup")]
    pub property_group: Vec<Option<ChargeItemDefinitionPropertyGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_propertyGroup")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub property_group_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ChargeItemDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ChargeItemDefinition", ".")]
    pub fn build(self) -> Result<ChargeItemDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ChargeItemDefinitionInner> for ChargeItemDefinition {
    fn from(inner: ChargeItemDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ChargeItemDefinition {
    type Target = ChargeItemDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ChargeItemDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ChargeItemDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ChargeItemDefinitionBuilder {
        ChargeItemDefinitionBuilder::default()
    }
}
impl ChargeItemDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ChargeItemDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in ChargeItemDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ChargeItemDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ChargeItemDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ChargeItemDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the applicability field in ChargeItemDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ChargeItemDefinitionApplicabilityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ChargeItemDefinitionApplicability {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 An expression that returns true or false, indicating whether the condition is satisfied. When using FHIRPath expressions, the %context environment variable must be replaced at runtime with the ChargeItem resource to which this definition is applied.

 Please note that FHIRPath Expressions can only be evaluated in the scope of the current ChargeItem resource to which this definition is being applied.
FHIRPath expressions can traverse into other resources linked from the ChargeItem resource, however, testing rules such as that a billing code may be billed only once per encounter need a wider scope. In such scenarios, CQL may be the appropriate choice. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Option<Expression>,
    /// 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>,
    /** **When the charge item definition is expected to be used**

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

 The effective period for a charge item 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>,
    /** **Reference to / quotation of the external source of the group of properties**

 Reference to / quotation of the external source of the group of properties.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Option<RelatedArtifact>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_artifact_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ChargeItemDefinitionApplicability {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ChargeItemDefinitionApplicabilityBuilder {
        ChargeItemDefinitionApplicabilityBuilder::default()
    }
}
/// Sub-fields of the propertyGroup field in ChargeItemDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ChargeItemDefinitionPropertyGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ChargeItemDefinitionPropertyGroup {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 under which the priceComponent is applicable**

 Expressions that describe applicability criteria for the priceComponent.

 The applicability conditions can be used to ascertain whether a billing item is allowed in a specific context. E.g. some billing codes may only be applicable in out-patient settings, only to male/female patients or only to children. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "applicability")]
    pub applicability: Vec<Option<ChargeItemDefinitionApplicability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_applicability")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub applicability_ext: Vec<Option<FieldExtension>>,
    /** **Components of total line item price**

 The price for a ChargeItem may be calculated as a base price with surcharges/deductions that apply in certain conditions. A ChargeItemDefinition resource that defines the prices, factors and conditions that apply to a billing code is currently under development. The priceComponent element can be used to offer transparency to the recipient of the Invoice of how the prices have been calculated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priceComponent")]
    pub price_component: Vec<Option<MonetaryComponent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_priceComponent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub price_component_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ChargeItemDefinitionPropertyGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ChargeItemDefinitionPropertyGroupBuilder {
        ChargeItemDefinitionPropertyGroupBuilder::default()
    }
}
/** The Citation Resource enables reference to any knowledge artifact for purposes of identification and attribution. The Citation Resource supports existing reference structures and developing publication practices such as versioning, expressing complex contributorship roles, and referencing computable resources.

 **[Citation](http://hl7.org/fhir/StructureDefinition/Citation) v5.0.0**

 A description of identification, location, or contributorship of a publication (article or artifact)

 The Citation Resource enables reference to any knowledge artifact for purposes of identification and attribution. The Citation Resource supports existing reference structures and developing publication practices such as versioning, expressing complex contributorship roles, and referencing computable resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Citation(pub Box<CitationInner>);
/** The Citation Resource enables reference to any knowledge artifact for purposes of identification and attribution. The Citation Resource supports existing reference structures and developing publication practices such as versioning, expressing complex contributorship roles, and referencing computable resources.

 **[Citation](http://hl7.org/fhir/StructureDefinition/Citation) v5.0.0**

 A description of identification, location, or contributorship of a publication (article or artifact)

 The Citation Resource enables reference to any knowledge artifact for purposes of identification and attribution. The Citation Resource supports existing reference structures and developing publication practices such as versioning, expressing complex contributorship roles, and referencing computable 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 = "CitationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CitationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Citation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Citation", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this citation record, represented as a globally unique URI**

 An absolute URI that is used to identify this citation record when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this summary is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the summary is stored on different servers.

 In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the meta.source element to indicate where the current master source of the resource can be found. */
    #[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>,
    /** **Identifier for the citation record itself**

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

 Use this element if you need to identify the citation record independently from identifying the cited artifact. */
    #[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 citation record**

 The identifier that is used to identify this version of the citation record when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the citation record 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 citation record instances that have the same identifier but different versions. The version can be appended to the url in a reference to allow a reference to a particular business version of the citation record with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 is newer, and a 0 if the version ordering can't successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<CitationVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<CitationVersionAlgorithmExtension>,
    /** **Name for this citation record (computer friendly)**

 A natural language name identifying the citation record. 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 alphanumeric type name to ensure that it is machine-processing 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 citation record (human friendly)**

 A short, descriptive, user-friendly title for the citation record.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. Use this element if you have a need for naming the citation record for human use, such as a display name for the citation record that is used when selecting citations from a list. */
    #[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 summary. Enables tracking the life-cycle of the content.

 Allows filtering of summaries that are appropriate for use versus not. Use "active" when the citation record is the version for others to actively use, "draft" while you are developing the content, and "retired" when this record should no longer be used for any purpose.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 citation record is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of citation records that are appropriate for use versus not. */
    #[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 last changed**

 The date (and optionally time) when the citation record was last significantly changed. The date must change 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 citation record changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the citation record. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 publisher of the citation record, not the publisher of the article or artifact being cited**

 The name of the organization or individual that published the citation record.

 Usually an organization but may be an individual. The publisher (or steward) of the citation record is the organization or individual primarily responsible for the maintenance and upkeep of the citation record. 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 citation record. 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 of the citation record**

 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 citation**

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

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the citation 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 citation is presumed to be the predominant language in the place the citation 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>,
    /** **The context that the citation record content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate citation record instances.

 When multiple useContexts are specified, there is no expectation that 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 citation record (if applicable)**

 A legal or geographic region in which the citation record is intended to be used.

 It may be possible for the citation record to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 citation is defined**

 Explanation of why this citation is needed and why it has been designed as it has.

 This element does not describe the usage of the citation. 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 citation. */
    #[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 for the citation record, not for the cited artifact**

 Use and/or publishing restrictions for the citation record, not for the cited artifact.

 */
    #[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>,
    /** **Copyright holder and year(s) for the ciation record, not for the cited artifact**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the citation record 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 citation record was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 citation record is expected to be used**

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

 The effective period for a citation record determines when the content is applicable for usage and is independent of publication and review dates. For example, a citation intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **Who authored the citation record**

 Who authored or created the citation record.

 The Citation.author element is structured to support a name (with a string datatype) and contact point information for the author/creator, and is not structured to support unique identifiers for the author. If detailed contributorship data is needed for the authorship of the citation record, then one can create a Citation Resource for the Citation Resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the citation record**

 Who edited or revised the citation record.

 The Citation.editor element is structured to support a name (with a string datatype) and contact point information for the editor, and is not structured to support unique identifiers for the editor. If detailed contributorship data is needed for the editing of the citation record, then one can create a Citation Resource for the Citation Resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the citation record**

 Who reviewed the citation record.

 The Citation.reviewer element is structured to support a name (with a string datatype) and contact point information for the reviewer, and is not structured to support unique identifiers for the reviewer. If detailed contributorship data is needed for the review of the citation record, then one can create a Citation Resource for the Citation Resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the citation record**

 Who endorsed the citation record.

 The Citation.endorser element is structured to support a name (with a string datatype) and contact point information for the endorser, and is not structured to support unique identifiers for the endorser. If detailed contributorship data is needed for the endorsement of the citation record, then one can create a Citation Resource for the Citation Resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **A human-readable display of key concepts to represent the citation**

 A human-readable display of key concepts to represent the citation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "summary")]
    pub summary: Vec<Option<CitationSummary>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_summary")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub summary_ext: Vec<Option<FieldExtension>>,
    /** **The assignment to an organizing scheme**

 The assignment to an organizing scheme.

 Use this element if you need to classify the citation record independently from classifying the cited artifact. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<CitationClassification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
    /** **Used for general notes and annotations not coded elsewhere**

 Used for general notes and annotations not coded 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>>,
    /** **[CitationStatusType](http://hl7.org/fhir/ValueSet/citation-status-type); The status of the citation record**

 The status of the citation record.

 Use this if needed for reporting the state or status of the citation record, NOT FOR reporting the state or status of the cited article. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "currentState")]
    pub current_state: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_currentState")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub current_state_ext: Vec<Option<FieldExtension>>,
    /** **An effective date or period for a status of the citation record**

 The state or status of the citation record paired with an effective date or period for that state.

 Use this if needed for reporting the state or status of the citation record, NOT FOR reporting the state or status of the cited article. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Vec<Option<CitationStatusDate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_date_ext: Vec<Option<FieldExtension>>,
    /** **Artifact related to the citation record**

 Artifact related to the citation record.

 Use this if needed for reporting artifacts related to the citation record, NOT FOR reporting artifacts related to the cited article. For example, one may use this element to report the data source for generation of the Citation Resource instance if it was automatically generated, such as conversion from a citation repository. */
    #[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>>,
    /** **The article or artifact being described**

 The article or artifact being described.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "citedArtifact")]
    pub cited_artifact: Option<CitationCitedArtifact>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_citedArtifact")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cited_artifact_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationBuilder {
    #[doc = concat!("Finalize building ", "Citation", ".")]
    pub fn build(self) -> Result<Citation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CitationInner> for Citation {
    fn from(inner: CitationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Citation {
    type Target = CitationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Citation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Citation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CitationBuilder {
        CitationBuilder::default()
    }
}
impl Citation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Citation
    }
}
/// Choice of types for the versionAlgorithm[x] field in Citation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CitationVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for CitationVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CitationVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the summary field in Citation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationSummaryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationSummary {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Format for display of the citation summary.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "style")]
    pub style: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_style")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub style_ext: Option<FieldExtension>,
    /** **The human-readable display of the citation summary**

 The human-readable display of the citation summary.

 */
    #[serde(rename = "text")]
    pub text: 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 CitationSummary {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationSummaryBuilder {
        CitationSummaryBuilder::default()
    }
}
/// Sub-fields of the classification field in Citation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationClassificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationClassification {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The kind of classifier (e.g. publication type, keyword).

 */
    #[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>,
    /** **[CitationArtifactClassifier](http://hl7.org/fhir/ValueSet/citation-artifact-classifier); The specific classification value**

 The specific classification value.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CitationClassification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationClassificationBuilder {
        CitationClassificationBuilder::default()
    }
}
/// Sub-fields of the statusDate field in Citation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationStatusDateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationStatusDate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The state or status of the citation record (that will be paired with the period).

 */
    #[serde(rename = "activity")]
    pub activity: CodeableConcept,
    /// 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>,
    /** **Either occurred or expected**

 Whether the status date is actual (has occurred) or expected (estimated or anticipated).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actual")]
    pub actual: Option<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>,
    /** **When the status started and/or ended**

 When the status started and/or ended.

 For an instance, place the same value in both start and end elements. */
    #[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 CitationStatusDate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationStatusDateBuilder {
        CitationStatusDateBuilder::default()
    }
}
/// Sub-fields of the citedArtifact field in Citation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifact {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. May include DOI, PMID, PMCID, etc**

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

 This element will contain unique identifiers that support de-duplication of citations. Commonly used identifiers for study citations include digital object identifier (DOI), PubMed ID (PMID), and PubMed Central ID (PMCID). To maintain interoperability, the suggested identifier.system values to use for these 3 identifiers are: DOI = "https://doi.org" PMID = "https://pubmed.ncbi.nlm.nih.gov" PMCID = "https://www.ncbi.nlm.nih.gov/pmc/" */
    #[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 not unique to the cited artifact. May include trial registry identifiers**

 A formal identifier that is used to identify things closely related to the cited artifact.

 May include trial registry identifiers, e.g. NCT04372602 from clinicaltrials.gov. This related identifier would not be used as unique identifier for the cited artifact itself. Multiple published articles (each with their own unique identifier) may relate to the same study record in a research registry. Commonly used related identifiers for study registries include ClinicalTrials.gov identifier (NCTId) and PROSPERO identifier (used for registration of systematic reviews). To maintain interoperability, the suggested identifier.system values to use for these 2 identifiers are: ClinicalTrials.gov = "https://clinicaltrials.gov" PROSPERO = "https://www.crd.york.ac.uk/prospero/" */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedIdentifier")]
    pub related_identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedIdentifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_identifier_ext: Vec<Option<FieldExtension>>,
    /** **When the cited artifact was accessed**

 When the cited artifact was accessed.

 Use this element when citing an artifact from a potentially unstable source, such as a webpage, to note the date (and time) the source was accessed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateAccessed")]
    pub date_accessed: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateAccessed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_accessed_ext: Option<FieldExtension>,
    /** **The defined version of the cited artifact**

 The defined version of the cited artifact.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<CitationCitedArtifactVersion>,
    /// 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>,
    /** **[CitedArtifactStatusType](http://hl7.org/fhir/ValueSet/cited-artifact-status-type); The status of the cited artifact**

 The status of the cited artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "currentState")]
    pub current_state: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_currentState")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub current_state_ext: Vec<Option<FieldExtension>>,
    /** **An effective date or period for a status of the cited artifact**

 An effective date or period, historical or future, actual or expected, for a status of the cited artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Vec<Option<CitationCitedArtifactStatusDate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_date_ext: Vec<Option<FieldExtension>>,
    /** **The title details of the article or artifact**

 The title details of the article or artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Vec<Option<CitationCitedArtifactTitle>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub title_ext: Vec<Option<FieldExtension>>,
    /** **Summary of the article or artifact**

 The abstract may be used to convey article-contained abstracts, externally-created abstracts, or other descriptive summaries.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "abstract")]
    pub r#abstract: Vec<Option<CitationCitedArtifactAbstract>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_abstract")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#abstract_ext: Vec<Option<FieldExtension>>,
    /** **The component of the article or artifact**

 The component of the article or artifact.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Option<CitationCitedArtifactPart>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_ext: Option<FieldExtension>,
    /** **The artifact related to the cited artifact**

 The artifact related to the cited artifact.

 The citedArtifact.relatesTo element uses a BackboneElement instead of the RelatedArtifact Datatype to enable use of an extended value set for the required code for the type of relationship. */
    #[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<CitationCitedArtifactRelatesTo>>,
    /// 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>>,
    /** **If multiple, used to represent alternative forms of the article that are not separate citations**

 If multiple, used to represent alternative forms of the article that are not separate citations.

 A common use is a journal article with a publication date and pagination for a print version and a different publication date for the online version of the same article. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publicationForm")]
    pub publication_form: Vec<Option<CitationCitedArtifactPublicationForm>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_publicationForm")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub publication_form_ext: Vec<Option<FieldExtension>>,
    /** **Used for any URL for the article or artifact cited**

 Used for any URL for the article or artifact cited.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "webLocation")]
    pub web_location: Vec<Option<CitationCitedArtifactWebLocation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_webLocation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub web_location_ext: Vec<Option<FieldExtension>>,
    /** **The assignment to an organizing scheme**

 The assignment to an organizing scheme.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<CitationCitedArtifactClassification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
    /** **Attribution of authors and other contributors**

 This element is used to list authors and other contributors, their contact information, specific contributions, and summary statements.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributorship")]
    pub contributorship: Option<CitationCitedArtifactContributorship>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contributorship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contributorship_ext: Option<FieldExtension>,
    /** **Any additional information or content for the article or artifact**

 Any additional information or content for the article or artifact.

 */
    #[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 CitationCitedArtifact {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactBuilder {
        CitationCitedArtifactBuilder::default()
    }
}
/// Sub-fields of the version field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactVersion {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 version number or other version identifier**

 The version number or other version identifier.

 */
    #[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>,
    /** **Citation for the main version of the cited artifact**

 Citation for the main version of the cited artifact.

 When referencing a baseCitation, one may inherit any data from the referenced Citation Resource and consider any data in the current Citation Resource as superceding to be version-specific. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseCitation")]
    pub base_citation: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseCitation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_citation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactVersionBuilder {
        CitationCitedArtifactVersionBuilder::default()
    }
}
/// Sub-fields of the statusDate field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactStatusDateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactStatusDate {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A definition of the status associated with a date or period.

 */
    #[serde(rename = "activity")]
    pub activity: CodeableConcept,
    /// 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>,
    /** **Either occurred or expected**

 Either occurred or expected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actual")]
    pub actual: Option<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>,
    /** **When the status started and/or ended**

 When the status started and/or ended.

 For an instance, place the same value in both start and end elements. */
    #[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 CitationCitedArtifactStatusDate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactStatusDateBuilder {
        CitationCitedArtifactStatusDateBuilder::default()
    }
}
/// Sub-fields of the title field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactTitleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactTitle {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Used to express the reason for or classification of the title.

 */
    #[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>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Used to express the specific language**

 Used to express the specific language of the title.

 */
    #[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>,
    /** **The title of the article or artifact**

 The title of the article or artifact.

 */
    #[serde(rename = "text")]
    pub text: 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 CitationCitedArtifactTitle {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactTitleBuilder {
        CitationCitedArtifactTitleBuilder::default()
    }
}
/// Sub-fields of the abstract field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactAbstractBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactAbstract {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Used to express the reason for or classification of the abstract.

 */
    #[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>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Used to express the specific language**

 Used to express the specific language of the abstract.

 */
    #[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>,
    /** **Abstract content**

 Abstract content.

 */
    #[serde(rename = "text")]
    pub text: 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>,
    /** **Copyright notice for the abstract**

 Copyright notice for the abstract.

 There is also a copyright element in the publicationForm element, so this copyright element is intended for copyright of the abstract. */
    #[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>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactAbstract {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactAbstractBuilder {
        CitationCitedArtifactAbstractBuilder::default()
    }
}
/// Sub-fields of the part field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactPartBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactPart {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The kind of component.

 */
    #[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 specification of the component**

 The specification of the component.

 */
    #[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>,
    /** **The citation for the full article or artifact**

 The citation for the full article or artifact.

 When referencing a baseCitation, one may inherit any data from the referenced Citation Resource and consider any data in the current Citation Resource as superceding to be specific to the citation of the specified part. For example, the part-specific Citation may have additional contributorship data that supercedes the contributorship data for the full citation when there is a need to uniquely report the contributorship for an image or supplement associated with the fuller citation record. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseCitation")]
    pub base_citation: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseCitation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_citation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactPart {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactPartBuilder {
        CitationCitedArtifactPartBuilder::default()
    }
}
/// Sub-fields of the relatesTo field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactRelatesToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactRelatesTo {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[RelatedArtifactTypeExpanded](http://hl7.org/fhir/ValueSet/related-artifact-type-all); documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of | part-of | amends | amended-with | appends | appended-with | cites | cited-by | comments-on | comment-in | contains | contained-in | corrects | correction-in | replaces | replaced-with | retracts | retracted-by | signs | similar-to | supports | supported-with | transforms | transformed-into | transformed-with | documents | specification-of | created-with | cite-as | reprint | reprint-of**

 The type of relationship to the related artifact.

 */
    #[serde(rename = "type")]
    pub r#type: codes::RelatedArtifactTypeExpanded,
    /// 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>,
    /** **[CitationArtifactClassifier](http://hl7.org/fhir/ValueSet/citation-artifact-classifier); Additional classifiers**

 Provides additional classifiers of the related artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **Short label**

 A short label that can be used to reference the related artifact from elsewhere in the containing artifact, such as a footnote index.

 Though not commonly used in citation records, this could be used for referencing other articles in the abstract or explanatory notes. */
    #[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>,
    /** **Brief description of the related artifact**

 A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.

 */
    #[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>,
    /** **Bibliographic citation for the artifact**

 A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "citation")]
    pub citation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_citation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub citation_ext: Option<FieldExtension>,
    /** **What document is being referenced**

 The document being referenced, represented as an attachment. Do not use this element if using the resource element to provide the canonical to the related artifact.

 To refer to related artifacts by URL, the FHIR Attachment Datatype includes a url element, so the path would be Citation.citedArtifact.relatesTo.document.url */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "document")]
    pub document: Option<Attachment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_document")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub document_ext: Option<FieldExtension>,
    /** **What artifact is being referenced**

 The related artifact, such as a library, value set, profile, or other knowledge resource.

 If the type is predecessor, this is a reference to the succeeding knowledge resource. If the type is successor, this is a reference to the prior knowledge resource */
    #[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>,
    /** **What artifact, if not a conformance resource**

 The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.

 If both resource and resourceReference are present, they SHOULD be consistent and reference the same resource. Although relatedArtifact is intended to support references to definitional resources, there are cases where non-definitional resources can be definitional (such as Location where the kind is mode). Related artifacts SHOULD be used to reference definitional resources, and profiles SHOULD be used to make that explicit for particular use cases. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resourceReference")]
    pub resource_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resourceReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactRelatesTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactRelatesToBuilder {
        CitationCitedArtifactRelatesToBuilder::default()
    }
}
/// Sub-fields of the publicationForm field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactPublicationFormBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactPublicationForm {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 collection the cited article or artifact is published in**

 The collection the cited article or artifact is published in.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publishedIn")]
    pub published_in: Option<CitationCitedArtifactPublicationFormPublishedIn>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publishedIn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub published_in_ext: Option<FieldExtension>,
    /** **[CitedMedium](http://hl7.org/fhir/ValueSet/cited-medium); Internet or Print**

 Describes the form of the medium cited. Common codes are "Internet" or "Print". The CitedMedium value set has 6 codes. The codes internet, print, and offline-digital-storage are the common codes for a typical publication form, though internet and print are more common for study citations. Three additional codes (each appending one of the primary codes with "-without-issue" are used for situations when a study is published both within an issue (of a periodical release as commonly done for journals) AND is published separately from the issue (as commonly done with early online publication), to represent specific identification of the publication form not associated with the issue.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "citedMedium")]
    pub cited_medium: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_citedMedium")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cited_medium_ext: Option<FieldExtension>,
    /** **Volume number of journal or other collection in which the article is published**

 Volume number of journal or other collection in which the article is published.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "volume")]
    pub volume: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_volume")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub volume_ext: Option<FieldExtension>,
    /** **Issue, part or supplement of journal or other collection in which the article is published**

 Issue, part or supplement of journal or other collection in which the article is published.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issue")]
    pub issue: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issue_ext: Option<FieldExtension>,
    /** **The date the article was added to the database, or the date the article was released**

 The date the article was added to the database, or the date the article was released.

 The articleDate is the preferred element for expressing the publication date as structured data. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "articleDate")]
    pub article_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_articleDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub article_date_ext: Option<FieldExtension>,
    /** **Text representation of the date on which the issue of the cited artifact was published**

 Text representation of the date on which the issue of the cited artifact was published.

 The publicationDateText element is prefererntially used when a date is not represented in a form that can be handled as structured data in other elements. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publicationDateText")]
    pub publication_date_text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publicationDateText")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publication_date_text_ext: Option<FieldExtension>,
    /** **Season in which the cited artifact was published**

 Spring, Summer, Fall/Autumn, Winter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publicationDateSeason")]
    pub publication_date_season: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publicationDateSeason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publication_date_season_ext: Option<FieldExtension>,
    /** **The date the article was last revised or updated in the database**

 The date the article was last revised or updated in the database.

 The lastRevisionDate is used for the cited article and not the date the Citation Resource is last revised. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastRevisionDate")]
    pub last_revision_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastRevisionDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_revision_date_ext: Option<FieldExtension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language(s) in which this form of the article is published**

 The language or languages in which this form of the article is published.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub language_ext: Vec<Option<FieldExtension>>,
    /** **Entry number or identifier for inclusion in a database**

 Entry number or identifier for inclusion in a database.

 Accession numbers may be used instead of or in addition to page numbers.  Accession numbers are functionally identifiers when coupled with the identity of the database for which they are accession numbers. Accession numbers which are used for indexing citations in a dataset of citations should NOT be entered in Citation.citedArtifact.publicationForm.accessionNumber -- this use would be a type of Citation.identifier for the citation record itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accessionNumber")]
    pub accession_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accessionNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accession_number_ext: Option<FieldExtension>,
    /** **Used for full display of pagination**

 Used for full display of pagination.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pageString")]
    pub page_string: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_pageString")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub page_string_ext: Option<FieldExtension>,
    /** **Used for isolated representation of first page**

 Used for isolated representation of first page.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "firstPage")]
    pub first_page: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_firstPage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub first_page_ext: Option<FieldExtension>,
    /** **Used for isolated representation of last page**

 Used for isolated representation of last page.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastPage")]
    pub last_page: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastPage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_page_ext: Option<FieldExtension>,
    /** **Number of pages or screens**

 Actual or approximate number of pages or screens. Distinct from reporting the page numbers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pageCount")]
    pub page_count: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_pageCount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub page_count_ext: Option<FieldExtension>,
    /** **Copyright notice for the full article or artifact**

 Copyright notice for the full article or artifact.

 It is possible that different publication forms have different copyright notices. */
    #[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>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactPublicationForm {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactPublicationFormBuilder {
        CitationCitedArtifactPublicationFormBuilder::default()
    }
}
/// Sub-fields of the publishedIn field in CitationCitedArtifactPublicationForm
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactPublicationFormPublishedInBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactPublicationFormPublishedIn {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Kind of container (e.g. Periodical, database, or book).

 Journals and newspapers are coded as Periodical. */
    #[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>,
    /** **Journal identifiers include ISSN, ISO Abbreviation and NLMuniqueID; Book identifiers include ISBN**

 Journal identifiers include ISSN, ISO Abbreviation and NLMuniqueID; Book identifiers include ISBN.

 */
    #[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 of the database or title of the book or journal**

 Name of the database or title of the book or journal.

 ClinicalTrials.gov is a name of a database. */
    #[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>,
    /** **Name of or resource describing the publisher**

 Name of or resource describing the publisher.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<Reference>,
    /// 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>,
    /** **Geographic location of the publisher**

 Geographic location of the publisher.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisherLocation")]
    pub publisher_location: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisherLocation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_location_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactPublicationFormPublishedIn {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactPublicationFormPublishedInBuilder {
        CitationCitedArtifactPublicationFormPublishedInBuilder::default()
    }
}
/// Sub-fields of the webLocation field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactWebLocationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactWebLocation {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ArtifactUrlClassifier](http://hl7.org/fhir/ValueSet/artifact-url-classifier); Code the reason for different URLs, e.g. abstract and full-text**

 A characterization of the object expected at the web location.

 Categories that may be frequently used for study citations may include abstract, full-text, supplement, webpage, and doi-based. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **The specific URL**

 The specific URL.

 Persistent URLs, like doi, are preferred. */
    #[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 CitationCitedArtifactWebLocation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactWebLocationBuilder {
        CitationCitedArtifactWebLocationBuilder::default()
    }
}
/// Sub-fields of the classification field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactClassificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactClassification {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The kind of classifier (e.g. publication type, keyword).

 */
    #[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>,
    /** **[CitationArtifactClassifier](http://hl7.org/fhir/ValueSet/citation-artifact-classifier); The specific classification value**

 The specific classification value.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **Complex or externally created classification**

 Complex or externally created classification.

 Examples relevant to study citations include MeSH Headings or Keywords that contain qualifier codings or sub-classifications, and include risk of bias assessments created by persons different from the creator of the citation record. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "artifactAssessment")]
    pub artifact_assessment: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_artifactAssessment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub artifact_assessment_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactClassification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactClassificationBuilder {
        CitationCitedArtifactClassificationBuilder::default()
    }
}
/// Sub-fields of the contributorship field in CitationCitedArtifact
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactContributorshipBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactContributorship {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Indicates if the list includes all authors and/or contributors.

 If list is incomplete, "et al" can be appended to Contributorship.summary.value for display purposes. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "complete")]
    pub complete: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_complete")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub complete_ext: Option<FieldExtension>,
    /** **An individual entity named as a contributor**

 An individual entity named as a contributor, for example in the author list or contributor list.

 Used to report contributorship in individualized ways. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entry")]
    pub entry: Vec<Option<CitationCitedArtifactContributorshipEntry>>,
    /// 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>>,
    /** **Used to record a display of the author/contributor list without separate data element for each list member**

 Used to record a display of the author/contributor list without separate data element for each list member.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "summary")]
    pub summary: Vec<Option<CitationCitedArtifactContributorshipSummary>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_summary")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub summary_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactContributorship {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactContributorshipBuilder {
        CitationCitedArtifactContributorshipBuilder::default()
    }
}
/// Sub-fields of the entry field in CitationCitedArtifactContributorship
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactContributorshipEntryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactContributorshipEntry {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identity of the individual contributor**

 The identity of the individual contributor.

 If naming a contributor without additional detail or further structured data, the display element within the Reference datatype may be used for a simple string without referencing another resource. */
    #[serde(rename = "contributor")]
    pub contributor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contributor_ext: Option<FieldExtension>,
    /** **For citation styles that use initials**

 For citation styles that use initials.

 This element is used to support a data element used for citations that is not otherwise supported fully by FHIR HumanName datatype. In some citation summary styles (e.g. Medline), authors are presented with full spelling of their last name (family name) and initials for all forenames (first names, middle names, preceding names, given names). As the FHIR HumanName Datatype does not have a specific element for forename initials and this is common in citation usage, the element is added to contributorship.entry directly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "forenameInitials")]
    pub forename_initials: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_forenameInitials")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub forename_initials_ext: Option<FieldExtension>,
    /** **Organizational affiliation**

 Organization affiliated with the contributor.

 If naming an organization without additional detail or further structured data, the display element within the Reference datatype may be used for a simple string without referencing another resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "affiliation")]
    pub affiliation: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_affiliation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub affiliation_ext: Vec<Option<FieldExtension>>,
    /** **[ArtifactContributionType](http://hl7.org/fhir/ValueSet/artifact-contribution-type); The specific contribution**

 This element identifies the specific nature of an individual’s contribution with respect to the cited work.

 The CreDiT taxonomy provides a way to encode contribution information. The purpose of CRediT is to provide transparency in contributions to scholarly published work, to enable improved systems of attribution, credit, and accountability. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributionType")]
    pub contribution_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributionType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contribution_type_ext: Vec<Option<FieldExtension>>,
    /** **[ContributorRole](http://hl7.org/fhir/ValueSet/contributor-role); The role of the contributor (e.g. author, editor, reviewer, funder)**

 The role of the contributor (e.g. author, editor, reviewer, funder).

 */
    #[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>,
    /** **Contributions with accounting for time or number**

 Contributions with accounting for time or number.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributionInstance")]
    pub contribution_instance: Vec<
        Option<CitationCitedArtifactContributorshipEntryContributionInstance>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributionInstance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contribution_instance_ext: Vec<Option<FieldExtension>>,
    /** **Whether the contributor is the corresponding contributor for the role**

 Whether the contributor is the corresponding contributor for the role.

 If there are multiple authors and one serves as the corresponding author, then that one would have correspondingContact = true. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "correspondingContact")]
    pub corresponding_contact: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_correspondingContact")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub corresponding_contact_ext: Option<FieldExtension>,
    /** **Ranked order of contribution**

 Provides a numerical ranking to represent the degree of contributorship relative to other contributors, such as 1 for first author and 2 for second author.

 Used to retain order of authorship as structured data */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rankingOrder")]
    pub ranking_order: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rankingOrder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ranking_order_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactContributorshipEntry {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactContributorshipEntryBuilder {
        CitationCitedArtifactContributorshipEntryBuilder::default()
    }
}
/// Sub-fields of the contributionInstance field in CitationCitedArtifactContributorshipEntry
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactContributorshipEntryContributionInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactContributorshipEntryContributionInstance {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The specific contribution.

 */
    #[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>,
    /** **The time that the contribution was made**

 The time that the contribution was made.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl CitationCitedArtifactContributorshipEntryContributionInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactContributorshipEntryContributionInstanceBuilder {
        CitationCitedArtifactContributorshipEntryContributionInstanceBuilder::default()
    }
}
/// Sub-fields of the summary field in CitationCitedArtifactContributorship
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CitationCitedArtifactContributorshipSummaryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CitationCitedArtifactContributorshipSummary {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Used most commonly to express an author list or a contributorship statement.

 */
    #[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>,
    /** **[ContributorSummaryStyle](http://hl7.org/fhir/ValueSet/contributor-summary-style); The format for the display string**

 The format for the display string, such as author last name with first letter capitalized followed by forename initials.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "style")]
    pub style: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_style")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub style_ext: Option<FieldExtension>,
    /** **[ContributorSummarySource](http://hl7.org/fhir/ValueSet/contributor-summary-source); Used to code the producer or rule for creating the display string**

 Used to code the producer or rule for creating the display string.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<CodeableConcept>,
    /// 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>,
    /** **The display string for the author list, contributor list, or contributorship statement**

 The display string for the author list, contributor list, or contributorship statement.

 */
    #[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 CitationCitedArtifactContributorshipSummary {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CitationCitedArtifactContributorshipSummaryBuilder {
        CitationCitedArtifactContributorshipSummaryBuilder::default()
    }
}
/** A provider issued list of professional services and products which have been provided, or are to be provided, to a patient which is sent to an insurer for reimbursement.

 **[Claim](http://hl7.org/fhir/StructureDefinition/Claim) v5.0.0**

 Claim, Pre-determination or Pre-authorization

 A provider issued list of professional services and products which have been provided, or are to be provided, to a patient which is sent to an insurer for reimbursement.

 The Claim resource fulfills three information request requirements: Claim - a request for adjudication for reimbursement for products and/or services provided; Preauthorization - a request to authorize the future provision of products and/or services including an anticipated adjudication; and, Predetermination - a request for a non-bind adjudication of possible future products and/or services. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Claim(pub Box<ClaimInner>);
/** A provider issued list of professional services and products which have been provided, or are to be provided, to a patient which is sent to an insurer for reimbursement.

 **[Claim](http://hl7.org/fhir/StructureDefinition/Claim) v5.0.0**

 Claim, Pre-determination or Pre-authorization

 A provider issued list of professional services and products which have been provided, or are to be provided, to a patient which is sent to an insurer for reimbursement.

 The Claim resource fulfills three information request requirements: Claim - a request for adjudication for reimbursement for products and/or services provided; Preauthorization - a request to authorize the future provision of products and/or services including an anticipated adjudication; and, Predetermination - a request for a non-bind adjudication of possible future products and/or 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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 claim**

 A unique identifier assigned to this claim.

 */
    #[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>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_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 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>,
    /** **[ClaimType](http://hl7.org/fhir/ValueSet/claim-type); Category or discipline**

 The category of claim, e.g. oral, pharmacy, vision, institutional, professional.

 The code system provides oral, pharmacy, vision, professional and institutional claim types. Those supported depends on the requirements of the jurisdiction. The valueset is extensible to accommodate other types of claims as required by the jurisdiction. */
    #[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>,
    /** **[ClaimSubType](http://hl7.org/fhir/ValueSet/claim-subtype); More granular claim type**

 A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.

 This may contain the local bill type codes, for example the US UB-04 bill type code or the CMS bill type. */
    #[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>,
    /** **[Use](http://hl7.org/fhir/ValueSet/claim-use); claim | preauthorization | predetermination**

 A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.

 */
    #[serde(rename = "use")]
    pub r#use: 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 recipient of the products and services**

 The party to whom the professional services and/or products have been supplied or are being considered and for whom actual or forecast reimbursement is sought.

 */
    #[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>,
    /** **Relevant time frame for the claim**

 The period for which charges are being submitted.

 Typically this would be today or in the past for a claim, and today or in the future for preauthorizations and predeterminations. Typically line item dates of service should fall within the billing period if one is specified. */
    #[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>,
    /** **Resource creation date**

 The date this resource was created.

 This field is independent of the date of creation of the resource as it may reflect the creation date of a source document prior to digitization. Typically for claims all services must be completed as of this date. */
    #[serde(rename = "created")]
    pub created: 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 of the claim**

 Individual who created the claim, predetermination or preauthorization.

 */
    #[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>,
    /** **Party responsible for the claim**

 The provider which is responsible for the claim, predetermination or preauthorization.

 Typically this field would be 1..1 where this party is accountable for the data content within the claim but is not necessarily the facility, provider group or practitioner who provided the products and services listed within this claim resource. This field is the Billing Provider, for example, a facility, provider group, lab or practitioner. */
    #[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>,
    /** **[ProcessPriority](http://hl7.org/fhir/ValueSet/process-priority); Desired processing urgency**

 The provider-required urgency of processing the request. Typical values include: stat, normal, deferred.

 If a claim processor is unable to complete the processing as per the priority then they should generate an error and not process the request. */
    #[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); For whom to reserve funds**

 A code to indicate whether and for whom funds are to be reserved for future claims.

 This field is only used for preauthorizations. */
    #[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>,
    /** **Prior or corollary claims**

 Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.

 For example,  for the original treatment and follow-up exams. */
    #[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 and products**

 Prescription is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.

 */
    #[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 superseded by fulfiller**

 Original prescription which has been superseded 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 therefore issues a new prescription for an alternate medication which has the same therapeutic 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>,
    /** **Recipient of benefits payable**

 The party to be reimbursed for cost of the products and services according to the terms of the policy.

 Often providers agree to receive the benefits payable to reduce the near-term costs to the patient. The insurer may decline to pay the provider and choose to pay the subscriber instead. */
    #[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 information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.

 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>,
    /** **Encounters associated with the listed treatments**

 Healthcare encounters related to this claim.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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>>,
    /** **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>,
    /** **[DiagnosisRelatedGroup](http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup); Package billing code**

 A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.

 For example DRG (Diagnosis Related Group) or a bundled billing code. A patient may have a diagnosis of a Myocardial Infarction and a DRG for HeartAttack would be assigned. The Claim item (and possible subsequent claims) would refer to the DRG for those line items that were for services related to the heart attack event. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisRelatedGroup")]
    pub diagnosis_related_group: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diagnosisRelatedGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnosis_related_group_ext: Option<FieldExtension>,
    /** **Event information**

 Information code for an event with a corresponding date or period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<ClaimEvent>>,
    /// 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>>,
    /** **Members of the care team**

 The members of the team who provided the products and services.

 */
    #[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>>,
    /** **Supporting information**

 Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.

 Often there are multiple 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 = "supportingInfo")]
    pub supporting_info: Vec<Option<ClaimSupportingInfo>>,
    /// 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>>,
    /** **Pertinent diagnosis information**

 Information about diagnoses relevant to the claim items.

 */
    #[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>>,
    /** **Clinical procedures performed**

 Procedures performed on the patient relevant to the billing items with the claim.

 */
    #[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>>,
    /** **Patient insurance information**

 Financial instruments for reimbursement for the health care products and services specified on the claim.

 All insurance coverages for the patient which may be applicable for reimbursement, of the products and services listed in the claim, are typically provided in the claim to allow insurers to confirm the ordering of the insurance coverages relative to local 'coordination of benefit' rules. One coverage (and only one) with 'focal=true' is to be used in the adjudication of this claim. Coverages appearing before the focal Coverage in the list, and where 'Coverage.subrogation=false', should provide a reference to the ClaimResponse containing the adjudication results of the prior claim. */
    #[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 of the event**

 Details of an accident which resulted in injuries which required the products and services listed in the claim.

 */
    #[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>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: Option<FieldExtension>,
    /** **Product or service provided**

 A claim line. Either a simple  product or service or a 'group' of details which can each be a simple items or groups of sub-details.

 */
    #[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 all the items in 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Reference to a related claim.

 */
    #[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**

 A code to convey how the claims are related.

 For example, prior claim 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>,
    /** **File or case reference**

 An alternate organizational reference to the case or file to which this particular claim pertains.

 For example, Property/Casualty 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Category of recipient**

 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>,
    /** **Recipient reference**

 Reference to the individual or organization to whom any payment will be made.

 Not required if the payee is 'subscriber' or 'provider'. */
    #[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 event 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 = "ClaimEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimEvent {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A coded event such as when a service is expected or a card printed.

 */
    #[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>,
    /** **Occurance date or period**

 A date or period in the past or future indicating when the event occurred or is expectd to occur.

 */
    #[serde(flatten)]
    pub when: ClaimEventWhen,
    /// 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<ClaimEventWhenExtension>,
}
#[cfg(feature = "builders")]
impl ClaimEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimEventBuilder {
        ClaimEventBuilder::default()
    }
}
/// Choice of types for the when[x] field in ClaimEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimEventWhen {
    /// Variant accepting the DateTime type.
    #[serde(rename = "whenDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
}
/// Extension value for ClaimEventWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimEventWhenExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_whenDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A number to uniquely identify care team entries.

 */
    #[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>,
    /** **Practitioner or organization**

 Member of the team who provided the product or 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>,
    /** **Indicator of the lead practitioner**

 The party who is billing and/or responsible for the claimed products or services.

 Responsible might not be required when there is only a single provider listed. */
    #[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); Function within the team**

 The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.

 Role might not be required when there is only a single provider listed. */
    #[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); Practitioner or provider specialization**

 The specialization of the practitioner or provider 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 = "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>,
}
#[cfg(feature = "builders")]
impl ClaimCareTeam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimCareTeamBuilder {
        ClaimCareTeamBuilder::default()
    }
}
/// Sub-fields of the supportingInfo 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 = "ClaimSupportingInfoBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimSupportingInfo {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 A number to uniquely identify supporting information entries.

 */
    #[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); Classification of the supplied information**

 The general class of the information supplied: information; exception; accident, employment; onset, etc.

 This may contain a category for the local bill type codes. */
    #[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.

 */
    #[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<ClaimSupportingInfoTiming>,
    /// 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<ClaimSupportingInfoTimingExtension>,
    /** **Data to be provided**

 Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.

 Could be used to provide references to other resources, document. For example could contain a PDF in an Attachment of the Police Report for an Accident. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ClaimSupportingInfoValue>,
    /// 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<ClaimSupportingInfoValueExtension>,
    /** **[MissingReason](http://hl7.org/fhir/ValueSet/missing-tooth-reason); Explanation for the information**

 Provides the reason in the situation where a reason code is required in addition to the content.

 For example: the reason for the additional stay, or why a tooth is  missing. */
    #[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 ClaimSupportingInfo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimSupportingInfoBuilder {
        ClaimSupportingInfoBuilder::default()
    }
}
/// Choice of types for the timing[x] field in ClaimSupportingInfo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimSupportingInfoTiming {
    /// Variant accepting the Date type.
    #[serde(rename = "timingDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
}
/// Extension value for ClaimSupportingInfoTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimSupportingInfoTimingExtension {
    /// 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 ClaimSupportingInfo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimSupportingInfoValue {
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// 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),
    /// Variant accepting the Identifier type.
    #[serde(rename = "valueIdentifier")]
    Identifier(Identifier),
}
/// Extension value for ClaimSupportingInfoValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimSupportingInfoValueExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// 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),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_valueIdentifier")]
    Identifier(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A number to uniquely identify diagnosis entries.

 Diagnosis are presented in list order to their expected importance: primary, secondary, etc. */
    #[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>,
    /** **Nature of illness or problem**

 The nature of illness or problem in a coded form or as a reference to an external defined Condition.

 */
    #[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**

 When the condition was observed or the relative ranking.

 For example: admitting, primary, secondary, discharge. */
    #[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>>,
    /** **[DiagnosisOnAdmission](http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission); Present on admission**

 Indication of whether the diagnosis was present on admission to a facility.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onAdmission")]
    pub on_admission: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onAdmission")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_admission_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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify procedure entries.

 */
    #[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>,
    /** **[ProcedureType](http://hl7.org/fhir/ValueSet/ex-procedure-type); Category of Procedure**

 When the condition was observed or the relative ranking.

 For example: primary, secondary. */
    #[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>>,
    /** **When the procedure was performed**

 Date and optionally time the procedure was performed.

 */
    #[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>,
    /** **Specific clinical procedure**

 The code or reference to a Procedure resource which identifies the clinical intervention performed.

 */
    #[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>,
    /** **Unique device identifier**

 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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify insurance entries and provide a sequence of coverages to 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>,
    /** **Coverage to be used for adjudication**

 A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.

 A patient may (will) have multiple insurance policies which provide reimbursement for healthcare services and products. For example a person may also be covered by their spouse's policy and both appear in the list (and may be from the same insurer). This flag will be set to true for only one of the listed policies and that policy will be used for adjudicating this claim. Other claims would be created to request adjudication against the other listed policies. */
    #[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>,
    /** **Pre-assigned Claim number**

 The business identifier to be used when the claim is sent for adjudication against this insurance policy.

 Only required in jurisdictions where insurers, rather than the provider, are required to send claims to  insurers that appear after them in the list. This element is not required when 'subrogation=true'. */
    #[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>,
    /** **Insurance information**

 Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.

 */
    #[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>,
    /** **Additional provider contract number**

 A business agreement number established between the provider and the insurer for special business processing purposes.

 */
    #[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>,
    /** **Prior authorization reference number**

 Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.

 This value is an alphanumeric string that may be provided over the phone, via text, via paper, or within a ClaimResponse resource and is not a FHIR Identifier. */
    #[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 result of the adjudication of the line items for the Coverage specified in this insurance.

 Must not be specified when 'focal=true' for this insurance. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 incident occurred**

 Date of an accident event  related to the products and services contained in the claim.

 The date of the accident has to precede the dates of the products and services but within a reasonable timeframe. */
    #[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://terminology.hl7.org/ValueSet/v3-ActIncidentCode); The nature of the accident**

 The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.

 */
    #[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 event occurred**

 The physical location of the accident event.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify item entries.

 */
    #[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>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Applicable careTeam members**

 CareTeam members related to this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeamSequence")]
    pub care_team_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeamSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable diagnoses**

 Diagnosis applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisSequence")]
    pub diagnosis_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosisSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable procedures**

 Procedures applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureSequence")]
    pub procedure_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable exception and supporting information**

 Exceptions, special conditions and supporting information applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSequence")]
    pub information_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_sequence_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **Request or Referral for Service**

 Request or Referral for Goods or Service to be rendered.

 */
    #[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>>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Product or service billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in Oral whether the treatment is cosmetic or associated with TMJ, or for Medical whether the treatment was outside the clinic or outside 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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 or product delivery**

 The date or dates when the service or product was supplied, 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 or where product was supplied**

 Where the product or 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>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the line item. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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>>,
    /** **Anatomical location**

 Physical location where the service is performed or applies.

 */
    #[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<ClaimItemBodySite>>,
    /// 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>>,
    /** **Encounters associated with the listed treatments**

 Healthcare encounters related to this claim.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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>>,
    /** **Product or service provided**

 A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.

 */
    #[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 bodySite 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 = "ClaimItemBodySiteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimItemBodySite {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Physical service site on the patient (limb, tooth, etc.).

 For example: Providing a tooth code, allows an insurer to identify a provider performing a filling on a tooth that was previously removed. */
    #[serde(rename = "site")]
    pub site: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Sub-location**

 A region or surface of the bodySite, e.g. 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>>,
}
#[cfg(feature = "builders")]
impl ClaimItemBodySite {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimItemBodySiteBuilder {
        ClaimItemBodySiteBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify item entries.

 */
    #[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>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the line item.detail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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>>,
    /** **Product or service provided**

 A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify item entries.

 */
    #[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>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for line item.detail.subDetail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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()
    }
}
/** This resource provides the adjudication details from the processing of a Claim resource.

 **[ClaimResponse](http://hl7.org/fhir/StructureDefinition/ClaimResponse) v5.0.0**

 Response to a claim predetermination or preauthorization

 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>);
/** This resource provides the adjudication details from the processing of a Claim resource.

 **[ClaimResponse](http://hl7.org/fhir/StructureDefinition/ClaimResponse) v5.0.0**

 Response to a claim predetermination or preauthorization

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 a claim response**

 A unique identifier assigned to this claim response.

 */
    #[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>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_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 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>,
    /** **[ClaimType](http://hl7.org/fhir/ValueSet/claim-type); More granular claim type**

 A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.

 This may contain the local bill type codes, for example the US UB-04 bill type code or the CMS bill type. */
    #[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>,
    /** **[ClaimSubType](http://hl7.org/fhir/ValueSet/claim-subtype); More granular claim type**

 A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.

 This may contain the local bill type codes, for example the US UB-04 bill type code or the CMS bill type. */
    #[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>,
    /** **[Use](http://hl7.org/fhir/ValueSet/claim-use); claim | preauthorization | predetermination**

 A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.

 */
    #[serde(rename = "use")]
    pub r#use: 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 recipient of the products and services**

 The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for facast reimbursement is sought.

 */
    #[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>,
    /** **Response creation date**

 The date this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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>,
    /** **Party responsible for reimbursement**

 The party responsible for authorization, adjudication and reimbursement.

 */
    #[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>,
    /** **Party responsible for the claim**

 The provider which is responsible for the claim, predetermination or preauthorization.

 Typically this field would be 1..1 where this party is accountable for the data content within the claim but is not necessarily the facility, provider group or practitioner who provided the products and services listed within this claim resource. This field is the Billing Provider, for example, a facility, provider group, lab or practitioner.. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestor")]
    pub requestor: Option<Reference>,
    /// 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>,
    /** **Id of resource triggering adjudication**

 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/claim-outcome); queued | complete | error | partial**

 The outcome of the claim, predetermination, or preauthorization processing.

 The resource may be used to indicate that the Claim/Preauthorization/Pre-determination has been received but processing has not begun (queued); that it has been processed and one or more errors have been detected (error); no errors were detected and some of the adjudication processing has been performed (partial); or all of the adjudication processing has completed without errors (complete). */
    #[serde(rename = "outcome")]
    pub outcome: codes::RemittanceOutcome,
    /// 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>,
    /** **[AdjudicationDecision](http://hl7.org/fhir/ValueSet/claim-decision); Result of the adjudication**

 The result of the claim, predetermination, or preauthorization adjudication.

 The element is used to indicate the current state of the adjudication overall for the claim resource, for example: the request has been held (pended) for adjudication processing, for manual review or other reasons; that it has been processed and will be paid, or the outstanding paid, as submitted (approved); that no amount will be paid (denied); or that some amount between zero and the submitted amount will be paid (partial). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A human readable 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>,
    /** **Preauthorization reference**

 Reference from the Insurer which is used in later communications which refers to this adjudication.

 This value is only present on preauthorization adjudications. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_ref_ext: Option<FieldExtension>,
    /** **Preauthorization reference effective period**

 The time frame during which this authorization is effective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthPeriod")]
    pub pre_auth_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_period_ext: Option<FieldExtension>,
    /** **Event information**

 Information code for an event with a corresponding date or period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<ClaimResponseEvent>>,
    /// 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>>,
    /** **[PayeeType](http://hl7.org/fhir/ValueSet/payeetype); Party to be paid any benefits payable**

 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 = "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>,
    /** **Encounters associated with the listed treatments**

 Healthcare encounters related to this claim.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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>>,
    /** **[DiagnosisRelatedGroup](http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup); Package billing code**

 A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.

 For example DRG (Diagnosis Related Group) or a bundled billing code. A patient may have a diagnosis of a Myocardial Infarction and a DRG for HeartAttack would be assigned. The Claim item (and possible subsequent claims) would refer to the DRG for those line items that were for services related to the heart attack event. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisRelatedGroup")]
    pub diagnosis_related_group: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diagnosisRelatedGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnosis_related_group_ext: Option<FieldExtension>,
    /** **Adjudication for claim line items**

 A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.

 */
    #[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 product or service lines.

 */
    #[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>>,
    /** **Header-level adjudication**

 The adjudication results which are presented at the header level rather than at the line-item or add-item levels.

 */
    #[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>>,
    /** **Adjudication totals**

 Categorized monetary totals for the adjudication.

 Totals for amounts submitted, co-pays, benefits payable etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Vec<Option<ClaimResponseTotal>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub total_ext: Vec<Option<FieldExtension>>,
    /** **Payment Details**

 Payment details for the adjudication of the claim.

 */
    #[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**

 A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.

 Fund would be release by a future claim quoting the preAuthRef of this response. Examples of values include: provider, patient, none. */
    #[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>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed form identifier**

 A code for the form to be used for printing the content.

 May be needed to identify specific jurisdictional forms. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "formCode")]
    pub form_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_formCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_code_ext: Option<FieldExtension>,
    /** **Printed reference or actual form**

 The actual form, by reference or inclusion, for printing the content or an EOB.

 Needed to permit insurers to include the actual form. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<Attachment>,
    /// 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>,
    /** **Note concerning adjudication**

 A note that describes or explains adjudication results in a human readable form.

 */
    #[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.

 For example: professional reports, documents, images, clinical resources, or accident reports. */
    #[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>>,
    /** **Patient insurance information**

 Financial instruments for reimbursement for the health care products and services specified on the claim.

 All insurance coverages for the patient which may be applicable for reimbursement, of the products and services listed in the claim, are typically provided in the claim to allow insurers to confirm the ordering of the insurance coverages relative to local 'coordination of benefit' rules. One coverage (and only one) with 'focal=true' is to be used in the adjudication of this claim. Coverages appearing before the focal Coverage in the list, and where 'subrogation=false', should provide a reference to the ClaimResponse containing the adjudication results of the prior claim. */
    #[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>>,
    /** **Processing errors**

 Errors encountered during the processing of the adjudication.

 If the request contains errors then an error element should be provided and no adjudication related sections (item, addItem, or payment) should be present. */
    #[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>>,
}
#[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 event 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 = "ClaimResponseEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseEvent {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A coded event such as when a service is expected or a card printed.

 */
    #[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>,
    /** **Occurance date or period**

 A date or period in the past or future indicating when the event occurred or is expectd to occur.

 */
    #[serde(flatten)]
    pub when: ClaimResponseEventWhen,
    /// 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<ClaimResponseEventWhenExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseEventBuilder {
        ClaimResponseEventBuilder::default()
    }
}
/// Choice of types for the when[x] field in ClaimResponseEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseEventWhen {
    /// Variant accepting the DateTime type.
    #[serde(rename = "whenDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
}
/// Extension value for ClaimResponseEventWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseEventWhenExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_whenDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 item instance identifier**

 A number to uniquely reference the claim item entries.

 */
    #[serde(rename = "itemSequence")]
    pub item_sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_itemSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_sequence_ext: Option<FieldExtension>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Adjudication details**

 If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.

 */
    #[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>>,
    /** **Adjudication for claim details**

 A claim detail. Either a simple (a product or service) or a 'group' of sub-details which are simple items.

 */
    #[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 reviewOutcome 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 = "ClaimResponseItemReviewOutcomeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseItemReviewOutcome {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The result of the claim, predetermination, or preauthorization adjudication.

 The element is used to indicate the current state of the adjudication overall for the claim resource, for example: the request has been held (pended) for adjudication processing, for manual review or other reasons; that it has been processed and will be paid, or the outstanding paid, as submitted (approved); that no amount will be paid (denied); or that some amount between zero and the submitted amount will be paid (partial). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **[AdjudicationDecisionReason](http://hl7.org/fhir/ValueSet/claim-decision-reason); Reason for result of the adjudication**

 The reasons for the result of the claim, predetermination, or preauthorization adjudication.

 */
    #[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>>,
    /** **Preauthorization reference**

 Reference from the Insurer which is used in later communications which refers to this adjudication.

 This value is only present on preauthorization adjudications. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_ref_ext: Option<FieldExtension>,
    /** **Preauthorization reference effective period**

 The time frame during which this authorization is effective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthPeriod")]
    pub pre_auth_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseItemReviewOutcome {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseItemReviewOutcomeBuilder {
        ClaimResponseItemReviewOutcomeBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Type of adjudication information**

 A code to indicate the information type of this adjudication record. Information types may include the value submitted, maximum values or percentages allowed or payable under the plan, amounts that: the patient is responsible for in aggregate or pertaining to this item; amounts paid by other coverages; and, the benefit payable for this item.

 For example codes 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**

 A code supporting the understanding of the adjudication result and explaining variance from expected amount.

 For example may indicate that the funds for this benefit type have been exhausted. */
    #[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 category.

 For example: amount submitted, eligible amount, co-payment, and benefit payable. */
    #[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 associated with the category. Mutually exclusive to the amount element above.

 For example: eligible percentage or co-payment percentage. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 detail instance identifier**

 A number to uniquely reference the claim detail entry.

 */
    #[serde(rename = "detailSequence")]
    pub detail_sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detailSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_sequence_ext: Option<FieldExtension>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Detail level 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>>,
    /** **Adjudication for claim sub-details**

 A sub-detail adjudication of a simple product or service.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 sub-detail instance identifier**

 A number to uniquely reference the claim sub-detail entry.

 */
    #[serde(rename = "subDetailSequence")]
    pub sub_detail_sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subDetailSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_detail_sequence_ext: Option<FieldExtension>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Subdetail level 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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Claim 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 = "itemSequence")]
    pub item_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_itemSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Detail sequence number**

 The sequence number of the details within the claim item which this line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detailSequence")]
    pub detail_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detailSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Subdetail sequence number**

 The sequence number of the sub-details within the details within the claim item which this line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subdetailSequence")]
    pub subdetail_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subdetailSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subdetail_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Authorized providers**

 The providers who are authorized for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub provider_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **Request or Referral for Service**

 Request or Referral for Goods or Service to be rendered.

 */
    #[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>>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in Oral whether the treatment is cosmetic or associated with TMJ, or for Medical whether the treatment was outside the clinic or outside 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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 or product delivery**

 The date or dates when the service or product was supplied, 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<ClaimResponseAddItemServiced>,
    /// 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<ClaimResponseAddItemServicedExtension>,
    /** **Place of service or where product was supplied**

 Where the product or 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<ClaimResponseAddItemLocation>,
    /// 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<ClaimResponseAddItemLocationExtension>,
    /** **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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the addItem. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Anatomical location**

 Physical location where the service is performed or applies.

 */
    #[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<ClaimResponseAddItemBodySite>>,
    /// 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>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items adjudication**

 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>>,
    /** **Insurer added line 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()
    }
}
/// Choice of types for the serviced[x] field in ClaimResponseAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseAddItemServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for ClaimResponseAddItemServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseAddItemServicedExtension {
    /// 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 ClaimResponseAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseAddItemLocation {
    /// 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 ClaimResponseAddItemLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimResponseAddItemLocationExtension {
    /// 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 bodySite 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 = "ClaimResponseAddItemBodySiteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseAddItemBodySite {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Physical service site on the patient (limb, tooth, etc.).

 For example: Providing a tooth code allows an insurer to identify a provider performing a filling on a tooth that was previously removed. */
    #[serde(rename = "site")]
    pub site: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Sub-location**

 A region or surface of the bodySite, e.g. 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>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseAddItemBodySite {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseAddItemBodySiteBuilder {
        ClaimResponseAddItemBodySiteBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in Oral whether the treatment is cosmetic or associated with TMJ, or for Medical whether the treatment was outside the clinic or outside 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>>,
    /** **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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the addItem.detail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 level adjudication results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items detail adjudication**

 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>>,
    /** **Insurer added line items**

 The third-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 = "subDetail")]
    pub sub_detail: Vec<Option<ClaimResponseAddItemDetailSubDetail>>,
    /// 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 ClaimResponseAddItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseAddItemDetailBuilder {
        ClaimResponseAddItemDetailBuilder::default()
    }
}
/// Sub-fields of the subDetail field in ClaimResponseAddItemDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseAddItemDetailSubDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseAddItemDetailSubDetail {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in Oral whether the treatment is cosmetic or associated with TMJ, or for Medical whether the treatment was outside the clinic or outside 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>>,
    /** **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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the addItem.detail.subDetail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 subdetail level adjudication results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ClaimResponseItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items subdetail adjudication**

 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>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseAddItemDetailSubDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseAddItemDetailSubDetailBuilder {
        ClaimResponseAddItemDetailSubDetailBuilder::default()
    }
}
/// Sub-fields of the total 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 = "ClaimResponseTotalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseTotal {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Type of adjudication information**

 A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.

 For example codes 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>,
    /** **Financial total for the category**

 Monetary total amount associated with the category.

 */
    #[serde(rename = "amount")]
    pub amount: 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 ClaimResponseTotal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseTotalBuilder {
        ClaimResponseTotalBuilder::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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 payment**

 Whether this represents partial or complete payment of the benefits payable.

 */
    #[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>,
    /** **Payment adjustment for non-claim issues**

 Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.

 Insurers will deduct amounts owing from the provider (adjustment), such as a prior overpayment, from the amount owing to the provider (benefits payable) when payment is made to the provider. */
    #[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 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 date the payment will be issued or the actual issue date of payment.

 */
    #[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**

 Benefits payable less any payment adjustment.

 */
    #[serde(rename = "amount")]
    pub amount: 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>,
    /** **Business identifier for the payment**

 Issuer's unique identifier for the payment instrument.

 For example: EFT number or check number. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A number to uniquely identify a note entry.

 */
    #[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); Note purpose**

 The business purpose of the note text.

 */
    #[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 explanation or description associated with the processing.

 */
    #[serde(rename = "text")]
    pub text: 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/all-languages); Language of the text**

 A code to define the language used in the text of the note.

 Only required if the language is different from the resource language. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify insurance entries and provide a sequence of coverages to 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>,
    /** **Coverage to be used for adjudication**

 A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.

 A patient may (will) have multiple insurance policies which provide reimbursement for healthcare services and products. For example a person may also be covered by their spouse's policy and both appear in the list (and may be from the same insurer). This flag will be set to true for only one of the listed policies and that policy will be used for adjudicating this claim. Other claims would be created to request adjudication against the other listed policies. */
    #[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 insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.

 */
    #[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>,
    /** **Additional provider contract number**

 A business agreement number established between the provider and the insurer for special business processing purposes.

 */
    #[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>,
    /** **Adjudication results**

 The result of the adjudication of the line items for the Coverage specified in this insurance.

 Must not be specified when 'focal=true' for this insurance. */
    #[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()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 occurs outside of the item structure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "itemSequence")]
    pub item_sequence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_itemSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_sequence_ext: Option<FieldExtension>,
    /** **Detail sequence number**

 The sequence number of the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detailSequence")]
    pub detail_sequence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detailSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_sequence_ext: Option<FieldExtension>,
    /** **Subdetail sequence number**

 The sequence number of the sub-detail within the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subDetailSequence")]
    pub sub_detail_sequence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subDetailSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_detail_sequence_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>,
    /** **FHIRPath of element(s) related to issue**

 A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names, repetition indicators and the default child accessor 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 ClaimResponseError {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseErrorBuilder {
        ClaimResponseErrorBuilder::default()
    }
}
/** 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.

 **[ClinicalImpression](http://hl7.org/fhir/StructureDefinition/ClinicalImpression) v5.0.0**

 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>);
/** 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.

 **[ClinicalImpression](http://hl7.org/fhir/StructureDefinition/ClinicalImpression) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[ClinicalImpressionStatus](http://hl7.org/fhir/ValueSet/event-status); preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown**

 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::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>,
    /** **[ClinicalImpressionStatusReason](http://hl7.org/fhir/ValueSet/clinicalimpression-status-reason); Reason for current status**

 Captures the reason for the current state of the ClinicalImpression.

 This is generally only used for "exception" statuses such as "not-done", "on-hold" or "stopped". */
    #[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>,
    /** **Why/how the assessment was performed**

 A summary of the context and/or cause of the assessment - why / where it was 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>,
    /** **The Encounter during which this ClinicalImpression was created**

 The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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>,
    /** **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 = "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>,
    /** **Reference to last assessment**

 A reference to the last assessment that was conducted on 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**

 A list of the relevant problems/conditions for a patient.

 e.g. The patient is a pregnant, has congestive heart failure, has an ‎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>>,
    /** **[ClinicalImpressionChangePattern](http://hl7.org/fhir/ValueSet/clinicalimpression-change-pattern); Change in the status/pattern of a subject's condition since previously assessed, such as worsening, improving, or no change**

 Change in the status/pattern of a subject's condition since previously assessed, such as worsening, improving, or no change.  It is a subjective assessment of the direction of the change.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "changePattern")]
    pub change_pattern: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_changePattern")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub change_pattern_ext: 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 were 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>>,
    /** **Information supporting the clinical impression**

 Information supporting the clinical impression, which can contain investigation results.

 */
    #[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 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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Option<CodeableReference>,
    /// 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>,
    /** **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()
    }
}
/** A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure.

 **[ClinicalUseDefinition](http://hl7.org/fhir/StructureDefinition/ClinicalUseDefinition) v5.0.0**

 A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure

 A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ClinicalUseDefinition(pub Box<ClinicalUseDefinitionInner>);
/** A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure.

 **[ClinicalUseDefinition](http://hl7.org/fhir/StructureDefinition/ClinicalUseDefinition) v5.0.0**

 A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure

 A single issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or 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 = "ClinicalUseDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ClinicalUseDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ClinicalUseDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ClinicalUseDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this issue**

 Business identifier for this issue.

 */
    #[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>>,
    /** **[ClinicalUseDefinitionType](http://hl7.org/fhir/ValueSet/clinical-use-definition-type); indication | contraindication | interaction | undesirable-effect | warning**

 indication | contraindication | interaction | undesirable-effect | warning.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ClinicalUseDefinitionType,
    /// 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>,
    /** **[ClinicalUseDefinitionCategory](http://hl7.org/fhir/ValueSet/clinical-use-definition-category); A categorisation of the issue, primarily for dividing warnings into subject heading areas such as "Pregnancy", "Overdose"**

 A categorisation of the issue, primarily for dividing warnings into subject heading areas such as "Pregnancy and Lactation", "Overdose", "Effects on Ability to Drive and Use Machines".

 */
    #[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>>,
    /** **The medication, product, substance, device, procedure etc. for which this is an indication**

 The medication, product, substance, device, procedure etc. for which this is an indication.

 */
    #[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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); Whether this is a current issue or one that has been retired etc**

 Whether this is a current issue or one that has been retired etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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>,
    /** **Specifics for when this is a contraindication**

 Specifics for when this is a contraindication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contraindication")]
    pub contraindication: Option<ClinicalUseDefinitionContraindication>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contraindication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contraindication_ext: Option<FieldExtension>,
    /** **Specifics for when this is an indication**

 Specifics for when this is an indication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Option<ClinicalUseDefinitionIndication>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_indication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub indication_ext: Option<FieldExtension>,
    /** **Specifics for when this is an interaction**

 Specifics for when this is an interaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interaction")]
    pub interaction: Option<ClinicalUseDefinitionInteraction>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_interaction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub interaction_ext: Option<FieldExtension>,
    /** **The population group to which this applies**

 The population group to which this applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "population")]
    pub population: Vec<Option<Reference>>,
    /// 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>>,
    /** **Logic used by the clinical use definition**

 Logic used by the clinical use 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<String>>,
    /// 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>>,
    /** **A possible negative outcome from the use of this treatment**

 Describe the possible undesirable effects (negative outcomes) from the use of the medicinal product as treatment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "undesirableEffect")]
    pub undesirable_effect: Option<ClinicalUseDefinitionUndesirableEffect>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_undesirableEffect")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub undesirable_effect_ext: Option<FieldExtension>,
    /** **Critical environmental, health or physical risks or hazards. For example 'Do not operate heavy machinery', 'May cause drowsiness'**

 A critical piece of information about environmental, health or physical risks or hazards that serve as caution to the user. For example 'Do not operate heavy machinery', 'May cause drowsiness', or 'Get medical advice/attention if you feel unwell'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "warning")]
    pub warning: Option<ClinicalUseDefinitionWarning>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_warning")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub warning_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ClinicalUseDefinition", ".")]
    pub fn build(self) -> Result<ClinicalUseDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ClinicalUseDefinitionInner> for ClinicalUseDefinition {
    fn from(inner: ClinicalUseDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ClinicalUseDefinition {
    type Target = ClinicalUseDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ClinicalUseDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ClinicalUseDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionBuilder {
        ClinicalUseDefinitionBuilder::default()
    }
}
impl ClinicalUseDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ClinicalUseDefinition
    }
}
/// Sub-fields of the contraindication field in ClinicalUseDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionContraindicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionContraindication {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The situation that is being documented as contraindicating against this item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diseaseSymptomProcedure")]
    pub disease_symptom_procedure: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diseaseSymptomProcedure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disease_symptom_procedure_ext: Option<FieldExtension>,
    /** **[DiseaseStatus](http://hl7.org/fhir/ValueSet/disease-status); The status of the disease or symptom for the contraindication**

 The status of the disease or symptom for the contraindication, for example "chronic" or "metastatic".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diseaseStatus")]
    pub disease_status: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diseaseStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disease_status_ext: Option<FieldExtension>,
    /** **[DiseaseSymptomProcedure](http://hl7.org/fhir/ValueSet/disease-symptom-procedure); A comorbidity (concurrent condition) or coinfection**

 A comorbidity (concurrent condition) or coinfection.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comorbidity")]
    pub comorbidity: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_comorbidity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub comorbidity_ext: Vec<Option<FieldExtension>>,
    /** **The indication which this is a contraidication for**

 The indication which this is a contraidication for.

 */
    #[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>>,
    /** **An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements**

 An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements.

 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 = "applicability")]
    pub applicability: Option<Expression>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_applicability")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applicability_ext: Option<FieldExtension>,
    /** **Information about use of the product in relation to other therapies described as part of the contraindication**

 Information about the use of the medicinal product in relation to other therapies described as part of the contraindication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "otherTherapy")]
    pub other_therapy: Vec<Option<ClinicalUseDefinitionContraindicationOtherTherapy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_otherTherapy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub other_therapy_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionContraindication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionContraindicationBuilder {
        ClinicalUseDefinitionContraindicationBuilder::default()
    }
}
/// Sub-fields of the otherTherapy field in ClinicalUseDefinitionContraindication
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionContraindicationOtherTherapyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionContraindicationOtherTherapy {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The type of relationship between the medicinal product indication or contraindication and another therapy.

 */
    #[serde(rename = "relationshipType")]
    pub relationship_type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationshipType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_type_ext: Option<FieldExtension>,
    /** **[Therapy](http://hl7.org/fhir/ValueSet/therapy); Reference to a specific medication, substance etc. as part of an indication or contraindication**

 Reference to a specific medication (active substance, medicinal product or class of products, biological, food etc.) as part of an indication or contraindication.

 */
    #[serde(rename = "treatment")]
    pub treatment: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_treatment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub treatment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionContraindicationOtherTherapy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionContraindicationOtherTherapyBuilder {
        ClinicalUseDefinitionContraindicationOtherTherapyBuilder::default()
    }
}
/// Sub-fields of the indication field in ClinicalUseDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionIndicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionIndication {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The situation that is being documented as an indicaton for this item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diseaseSymptomProcedure")]
    pub disease_symptom_procedure: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diseaseSymptomProcedure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disease_symptom_procedure_ext: Option<FieldExtension>,
    /** **[DiseaseStatus](http://hl7.org/fhir/ValueSet/disease-status); The status of the disease or symptom for the indication**

 The status of the disease or symptom for the indication, for example "chronic" or "metastatic".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diseaseStatus")]
    pub disease_status: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diseaseStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disease_status_ext: Option<FieldExtension>,
    /** **[DiseaseSymptomProcedure](http://hl7.org/fhir/ValueSet/disease-symptom-procedure); A comorbidity or coinfection as part of the indication**

 A comorbidity (concurrent condition) or coinfection as part of the indication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comorbidity")]
    pub comorbidity: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_comorbidity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub comorbidity_ext: Vec<Option<FieldExtension>>,
    /** **[ProductIntendedUse](http://hl7.org/fhir/ValueSet/product-intended-use); The intended effect, aim or strategy to be achieved**

 The intended effect, aim or strategy to be achieved.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedEffect")]
    pub intended_effect: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intendedEffect")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intended_effect_ext: Option<FieldExtension>,
    /** **Timing or duration information**

 Timing or duration information, that may be associated with use with the indicated condition e.g. Adult patients suffering from myocardial infarction (from a few days until less than 35 days), ischaemic stroke (from 7 days until less than 6 months).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub duration: Option<ClinicalUseDefinitionIndicationDuration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub duration_ext: Option<ClinicalUseDefinitionIndicationDurationExtension>,
    /** **An unwanted side effect or negative outcome of the subject of this resource when being used for this indication**

 An unwanted side effect or negative outcome that may happen if you use the drug (or other subject of this resource) for this indication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "undesirableEffect")]
    pub undesirable_effect: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_undesirableEffect")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub undesirable_effect_ext: Vec<Option<FieldExtension>>,
    /** **An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements**

 An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements.

 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 = "applicability")]
    pub applicability: Option<Expression>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_applicability")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applicability_ext: Option<FieldExtension>,
    /** **The use of the medicinal product in relation to other therapies described as part of the indication**

 Information about the use of the medicinal product in relation to other therapies described as part of the indication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "otherTherapy")]
    pub other_therapy: Vec<Option<ClinicalUseDefinitionContraindicationOtherTherapy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_otherTherapy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub other_therapy_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionIndication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionIndicationBuilder {
        ClinicalUseDefinitionIndicationBuilder::default()
    }
}
/// Choice of types for the duration[x] field in ClinicalUseDefinitionIndication
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalUseDefinitionIndicationDuration {
    /// Variant accepting the Range type.
    #[serde(rename = "durationRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "durationString")]
    String(String),
}
/// Extension value for ClinicalUseDefinitionIndicationDuration.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalUseDefinitionIndicationDurationExtension {
    /// Variant accepting the Range extension.
    #[serde(rename = "_durationRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_durationString")]
    String(FieldExtension),
}
/// Sub-fields of the interaction field in ClinicalUseDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionInteractionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionInteraction {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 medication, product, food etc. or laboratory test that interacts**

 The specific medication, product, food, substance etc. or laboratory test that interacts.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interactant")]
    pub interactant: Vec<Option<ClinicalUseDefinitionInteractionInteractant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interactant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interactant_ext: Vec<Option<FieldExtension>>,
    /** **[InteractionType](http://hl7.org/fhir/ValueSet/interaction-type); The type of the interaction e.g. drug-drug interaction, drug-lab test interaction**

 The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.

 */
    #[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>,
    /** **[InteractionEffect](http://hl7.org/fhir/ValueSet/interaction-effect); The effect of the interaction, for example "reduced gastric absorption of primary medication"**

 The effect of the interaction, for example "reduced gastric absorption of primary medication".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effect")]
    pub effect: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effect")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effect_ext: Option<FieldExtension>,
    /** **[UndesirableEffectSymptom](http://hl7.org/fhir/ValueSet/interaction-incidence); The incidence of the interaction, e.g. theoretical, observed**

 The incidence of the interaction, e.g. theoretical, observed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "incidence")]
    pub incidence: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_incidence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub incidence_ext: Option<FieldExtension>,
    /** **[InteractionManagement](http://hl7.org/fhir/ValueSet/interaction-management); Actions for managing the interaction**

 Actions for managing the interaction.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "management")]
    pub management: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_management")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub management_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionInteraction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionInteractionBuilder {
        ClinicalUseDefinitionInteractionBuilder::default()
    }
}
/// Sub-fields of the interactant field in ClinicalUseDefinitionInteraction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionInteractionInteractantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionInteractionInteractant {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 medication, product, food etc. or laboratory test that interacts**

 The specific medication, product, food, substance etc. or laboratory test that interacts.

 */
    #[serde(flatten)]
    pub item: ClinicalUseDefinitionInteractionInteractantItem,
    /// 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<ClinicalUseDefinitionInteractionInteractantItemExtension>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionInteractionInteractant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionInteractionInteractantBuilder {
        ClinicalUseDefinitionInteractionInteractantBuilder::default()
    }
}
/// Choice of types for the item[x] field in ClinicalUseDefinitionInteractionInteractant
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalUseDefinitionInteractionInteractantItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for ClinicalUseDefinitionInteractionInteractantItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalUseDefinitionInteractionInteractantItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the undesirableEffect field in ClinicalUseDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionUndesirableEffectBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionUndesirableEffect {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The situation in which the undesirable effect may manifest.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "symptomConditionEffect")]
    pub symptom_condition_effect: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_symptomConditionEffect")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub symptom_condition_effect_ext: Option<FieldExtension>,
    /** **[UndesirableEffectClassification](http://hl7.org/fhir/ValueSet/undesirable-effect-classification); High level classification of the effect**

 High level classification of the effect.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub classification_ext: Option<FieldExtension>,
    /** **[UndesirablEffectFrequency](http://hl7.org/fhir/ValueSet/undesirable-effect-frequency); How often the effect is seen**

 How often the effect is seen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "frequencyOfOccurrence")]
    pub frequency_of_occurrence: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_frequencyOfOccurrence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub frequency_of_occurrence_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionUndesirableEffect {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionUndesirableEffectBuilder {
        ClinicalUseDefinitionUndesirableEffectBuilder::default()
    }
}
/// Sub-fields of the warning field in ClinicalUseDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalUseDefinitionWarningBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalUseDefinitionWarning {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 textual definition of this warning, with formatting**

 A textual definition of this warning, with formatting.

 */
    #[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>,
    /** **[WarningType](http://hl7.org/fhir/ValueSet/warning-type); A coded or unformatted textual definition of this warning**

 A coded or unformatted textual definition of this warning.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ClinicalUseDefinitionWarning {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalUseDefinitionWarningBuilder {
        ClinicalUseDefinitionWarningBuilder::default()
    }
}
/** The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.

 **[CodeSystem](http://hl7.org/fhir/StructureDefinition/CodeSystem) v5.0.0**

 Declares the existence of and describes a code system or code system supplement

 The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CodeSystem(pub Box<CodeSystemInner>);
/** The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its content.

 **[CodeSystem](http://hl7.org/fhir/StructureDefinition/CodeSystem) v5.0.0**

 Declares the existence of and describes a code system or code system supplement

 The CodeSystem resource is used to declare the existence of and describe a code system or code system supplement and its key properties, and optionally define a part or all of its 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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this code system, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this code system is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the code system is stored on different servers. 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 (business identifier)**

 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, and can then identify this code system outside of FHIR, where it is not possible to use the logical URI.  Note that HL7 defines at least three identifiers for many of its code systems - the FHIR canonical URL, the OID and the V2 Table 0396 mnemonic code. */
    #[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 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 reference to a particular business version of the code system with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which CodeSystem is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<CodeSystemVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<CodeSystemVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 systems that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the code system was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 code system is presumed to be the predominant language in the place the code system 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate code system instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the CodeSystem 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 CodeSystem was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 CodeSystem is expected to be used**

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

 The effective period for a CodeSystem  determines when the content is applicable for usage and is independent of publication and review dates. For example, a system intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptions related to the content of the CodeSystem. Topics provide a high-level categorization as well as keywords for the CodeSystem that can be useful for filtering and searching.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the CodeSystem**

 An individiual or organization primarily involved in the creation and maintenance of the CodeSystem.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the CodeSystem**

 An individual or organization primarily responsible for internal coherence of the CodeSystem.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the CodeSystem**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the CodeSystem.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the CodeSystem**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the CodeSystem for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, dependencies, bibliographic references, and predecessor and successor artifacts.

 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>>,
    /** **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 reference to the value set with entire code system**

 Canonical reference to the value set that contains all codes in the code system independent of code status.

 The definition of the value set SHALL include all codes from this code system, independent of concept status, and only codes from this code system. It SHALL be immutable, and operations SHOULD support validation of any allowed code compositions. */
    #[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 as represented in this resource.

 Note that other representations might have a different hierarchy or none at all, and represent the information using properties. */
    #[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 compositional grammar**

 The code system defines a compositional (post-coordination) 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 does not commit to concept permanence across versions. If true, 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'.

Most code systems occasionally refine the displays defined for concepts between versions. Contexts in which the concept display values are validated may require that the version be specified for some code systems irrespective of the value of this property. */
    #[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 | supplement**

 The extent of the content of the code system (the concepts and codes it defines) are represented in this resource instance.

 */
    #[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>,
    /** **Canonical URL of Code System this adds designations and properties to**

 The canonical URL of the code system that this code system supplement is adding designations and properties to.

 The most common use of a code system supplement is to add additional language support. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supplements")]
    pub supplements: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_supplements")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub supplements_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 basis of this count is defined by the system steward.

 The count of concepts defined in this resource cannot be more than this value but may be less for several reasons - see the content element. */
    #[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.

 Note that filters defined in code systems usually require custom code on the part of any terminology engine that will make them available for use in value set filters. For this reason, they are generally only seen in high value published terminologies. */
    #[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.

 Multiple occurrences of CodeSystem.concept.property may occur for a CodeSystem.property where     CodeSystem.concept.property.code is the same and CodeSystem.concept.property.value differs. For example: multiple designations for a single 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 meanings 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in CodeSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CodeSystemVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for CodeSystemVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CodeSystemVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 as a filter in [ValueSet](valueset.html#).compose.include.filter.

 */
    #[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); = | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | child-of | descendent-leaf | exists**

 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | decimal**

 The type of the property value. Properties of type "code" contain a code defined by the code system (e.g. a reference to another 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 Concepts have both a ```textdisplay``` and an array of ```textdesignation```. The display is equivalent to a special designation with an implied ```textdesignation.use``` of "primary code" and a language equal to the [Resource Language](resource.html#language). */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-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>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); Additional ways how this designation would be used**

 Additional codes that detail how this designation would be used, if there is more than one use.

 This was added rather than increasing the cardinality of .use to 0..* in order to maintain backward compatibility. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additionalUse")]
    pub additional_use: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_additionalUse")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub additional_use_ext: Vec<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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
}
/// 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),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
}
/** A clinical or business level record of information being transmitted or shared; e.g. an alert that was sent to a responsible provider, a public health agency communication to a provider/reporter in response to a case report for a reportable condition.

 **[Communication](http://hl7.org/fhir/StructureDefinition/Communication) v5.0.0**

 A clinical or business level record of information being transmitted or shared

 A clinical or business level record of information being transmitted or shared; e.g. an alert that was sent to a responsible provider, a public health agency communication to a provider/reporter in response to a case report for a reportable condition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Communication(pub Box<CommunicationInner>);
/** A clinical or business level record of information being transmitted or shared; e.g. an alert that was sent to a responsible provider, a public health agency communication to a provider/reporter in response to a case report for a reportable condition.

 **[Communication](http://hl7.org/fhir/StructureDefinition/Communication) v5.0.0**

 A clinical or business level record of information being transmitted or shared

 A clinical or business level record of information being transmitted or shared; e.g. an alert that was sent to a responsible provider, a public health agency communication to a provider/reporter in response to a case report for 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this communication by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Communication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Communication.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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, ServiceRequest, 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 referenced event (e.g. Communication, Procedure)**

 A larger event (e.g. Communication, Procedure) of which this particular communication is a component or step.

 The event the communication was part of - e.g. if you disclosed as "part" of counselling, it would be partOf that Procedure. */
    #[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>>,
    /** **Reply to**

 Prior communication that this communication is in response to.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inResponseTo")]
    pub in_response_to: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_inResponseTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub in_response_to_ext: Vec<Option<FieldExtension>>,
    /** **[CommunicationStatus](http://hl7.org/fhir/ValueSet/event-status); preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown**

 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>,
    /** **[CommunicationNotDoneReason](http://hl7.org/fhir/ValueSet/communication-not-done-reason); Reason for current status**

 Captures the reason for the current state of the Communication.

 This is generally only used for "exception" statuses such as "not-done", "suspended" or "aborted". The reason for performing the event at all is captured in reasonCode, not here. */
    #[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>,
    /** **[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>>,
    /** **[CommunicationPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Characterizes how quickly the planned or in progress communication must be addressed. Includes concepts such as stat, urgent, routine.

 Used to prioritize workflow (such as which communication to read first) when the communication is planned or in progress. */
    #[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://terminology.hl7.org/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>,
    /** **[CommunicationTopic](http://hl7.org/fhir/ValueSet/communication-topic); Description of the purpose/content**

 Description of the purpose/content, similar to a subject line in an email.

 Communication.topic.text can be used without any codings. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_ext: Option<FieldExtension>,
    /** **Resources that pertain to this communication**

 Other resources that pertain to this communication and to which this communication should be associated.

 Don't use Communication.about element when a more specific element exists, such as basedOn or reasonReference. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "about")]
    pub about: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_about")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub about_ext: Vec<Option<FieldExtension>>,
    /** **The Encounter during which this Communication was created**

 The Encounter during which this Communication was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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 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>,
    /** **Who the information is shared with**

 The entity (e.g. person, organization, clinical information system, care team or device) which is the target of the communication.

 If receipts need to be tracked by an individual, a separate resource instance will need to be created for each recipient.  Multiple recipient communications are intended where either receipts are not tracked (e.g. a mass mail-out) or a receipt 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>>,
    /** **Who shares the information**

 The entity (e.g. person, organization, clinical information system, or device) which is 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 captured using reason.concept.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<CodeableReference>>,
    /// 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>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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).

 The content can be codified or textual.  As an example of codified content, when working with machine generated communications, the payload may be drawn from a finite, terminology defined set of communications, especially for short, status update kinds of communications where more of a natural language approach isn't appropriate.

If the content isn't codified, contentCodeableConcept.text can be used.

When using contentCodeableConcept, the CodeableConcept is what is being communicated and is not a categorization of the content. */
    #[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 Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "contentCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for CommunicationPayloadContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationPayloadContentExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_contentCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** 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.

 **[CommunicationRequest](http://hl7.org/fhir/StructureDefinition/CommunicationRequest) v5.0.0**

 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>);
/** 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.

 **[CommunicationRequest](http://hl7.org/fhir/StructureDefinition/CommunicationRequest) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this communication request by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **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 multiple independent Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 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 | on-hold | revoked | completed | entered-in-error | unknown**

 The status of the proposal or order.

 */
    #[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>,
    /** **[CommunicationRequestStatusReason](http://hl7.org/fhir/ValueSet/communication-request-status-reason); Reason for current status**

 Captures the reason for the current state of the CommunicationRequest.

 This is generally only used for "exception" statuses such as "on-hold" or "revoked".  The reason why the CommunicationRequest was created at all is captured in reasonCode, not here. */
    #[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>,
    /** **[CommunicationRequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the level of authority/intentionality associated with the CommunicationRequest and where the request fits into the workflow chain.

 This element is expected to be immutable.  E.g. A "proposal" instance should never change to be a "plan" instance or "order" instance.  Instead, a new instance 'basedOn' the prior instance should be created with the new 'intent' value.

One exception to this is that the granularity of CommunicationRequest.intent is allowed to change.  For example, a Request identified as an "order" might later be clarified to be a "filler-order".  Or, in rarer cases (to meet recipient constraints), the reverse might also occur. */
    #[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>,
    /** **[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); routine | urgent | asap | stat**

 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>,
    /** **True if request is prohibiting action**

 If true indicates that the CommunicationRequest is asking for the specified action to *not* occur.

 The attributes provided with the request qualify what is not to be done. */
    #[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>,
    /** **[CommunicationMedium](http://terminology.hl7.org/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>,
    /** **Resources that pertain to this communication request**

 Other resources that pertain to this communication request and to which this communication request should be associated.

 Don't use CommunicationRequest.about element when a more specific element exists, such as basedOn, reasonReference, or replaces. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "about")]
    pub about: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_about")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub about_ext: Vec<Option<FieldExtension>>,
    /** **The Encounter during which this CommunicationRequest was created**

 The Encounter during which this CommunicationRequest was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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>,
    /** **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>,
    /** **Who asks for the information to be shared**

 The device, individual, or organization who asks for the information to be shared.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<Reference>,
    /// 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 to share the information with**

 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>>,
    /** **Who should share the information**

 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationProvider")]
    pub information_provider: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationProvider")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_provider_ext: Vec<Option<FieldExtension>>,
    /** **[CommunicationReason](http://terminology.hl7.org/ValueSet/v3-ActReason); Why is communication needed?**

 Describes why the request is being made in coded or textual form.

 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<CodeableReference>>,
    /// 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>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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).

 The content can be codified or textual.  As an example of codified content, when working with machine generated communications, the payload may be drawn from a finite, terminology defined set of communications, especially for short, status update kinds of communications where more of a natural language approach isn't appropriate.

If the content isn't codified, contentCodeableConcept.text can be used.

When using contentCodeableConcept, the CodeableConcept is what is being communicated and is not a categorization of the content. */
    #[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 Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "contentCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for CommunicationRequestPayloadContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationRequestPayloadContentExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_contentCodeableConcept")]
    CodeableConcept(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),
}
/** A compartment definition that defines how resources are accessed on a server.

 **[CompartmentDefinition](http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) v5.0.0**

 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>);
/** A compartment definition that defines how resources are accessed on a server.

 **[CompartmentDefinition](http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this compartment definition, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this compartment definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the compartment definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 compartment definition**

 The identifier that is used to identify this version of the compartment definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the compartment 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 compartment definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the compartment definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<CompartmentDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<CompartmentDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 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 compartment definition. Enables tracking the life-cycle of the content.

 Allows filtering of compartment definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the compartment definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 compartment definition is presumed to be the predominant language in the place the compartment definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate compartment definition instances.

 When multiple useContexts are specified, there is no expectation that 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>>,
    /** **Why this compartment definition is defined**

 Explanation 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>,
    /** **[CompartmentType](http://hl7.org/fhir/ValueSet/compartment-type); Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare**

 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in CompartmentDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CompartmentDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for CompartmentDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CompartmentDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
    /** **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>,
    /** **Search Param for interpreting $everything.start**

 Search Parameter for mapping requests made with $everything.start (e.g. on [Patient.$everything](patient-operation-everything.html)).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "startParam")]
    pub start_param: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_startParam")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_param_ext: Option<FieldExtension>,
    /** **Search Param for interpreting $everything.end**

 Search Parameter for mapping requests made with $everything.end (e.g. on [Patient.$everything](patient-operation-everything.html)).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endParam")]
    pub end_param: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endParam")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_param_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CompartmentDefinitionResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompartmentDefinitionResourceBuilder {
        CompartmentDefinitionResourceBuilder::default()
    }
}
/** A set of healthcare-related information that is assembled together into a single logical package 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. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).

 **[Composition](http://hl7.org/fhir/StructureDefinition/Composition) v5.0.0**

 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 package 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. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).

 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>);
/** A set of healthcare-related information that is assembled together into a single logical package 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. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).

 **[Composition](http://hl7.org/fhir/StructureDefinition/Composition) v5.0.0**

 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 package 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. A Composition defines the structure and narrative content necessary for a document. However, a Composition alone does not constitute a document. Rather, the Composition must be the first entry in a Bundle where Bundle.type=document, and any other resources referenced from Composition must be included as subsequent entries in the Bundle (for example Patient, Practitioner, Encounter, etc.).

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this Composition, represented as a URI (globally unique)**

 An absolute URI that is used to identify this Composition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this Composition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the Composition is stored on different servers.

 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>,
    /** **Version-independent identifier for the Composition**

 A version-independent identifier for the Composition. This identifier stays constant as the composition is changed over time.

 Similar to ClinicalDocument/setId in CDA. See discussion in resource definition for how these relate. */
    #[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>>,
    /** **An explicitly assigned identifer of a variation of the content in the Composition**

 An explicitly assigned identifer of a variation of the content in the Composition.

 While each resource, including the composition itself, has its own version identifier, this is a formal identifier for the logical version of the Composition as a whole. It would remain constant if the resources were moved to a new server, and all got new individual resource versions, for example. */
    #[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>,
    /** **[CompositionStatus](http://hl7.org/fhir/ValueSet/composition-status); registered | partial | preliminary | final | amended | corrected | appended | cancelled | entered-in-error | deprecated | unknown**

 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>,
    /** **[DocumentCategory](http://hl7.org/fhir/ValueSet/referenced-item-category); 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.

 */
    #[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 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(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 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. This means that the date on an amended document is the date of the amendment, not the date of original authorship. */
    #[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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate Composition instances.

 When multiple useContexts are specified, there is no expectation that 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>>,
    /** **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>>,
    /** **Name for this Composition (computer friendly)**

 A natural language name identifying the {{title}}. 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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **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>,
    /** **For any additional notes**

 For any additional notes.

 A comment, general note or annotation not coded 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>>,
    /** **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.

 To reference (using relatesTo) a Bundle of type "document" or another Composition where you only have the identifier, use a resourceReference with an identifier.\
When a Composition is an alternate representation of another type of document e.g. CDA, the other document could be referenced in a DocumentReference resource.
Here is an example of using relatesTo to reference another Bundle of type "document" or Composition where you only have the identifier:
```text
"relatesTo": [{
  "type": "replaces",
  "resourceReference": {
    "identifier": {
      "system": "...",
      "value": "..."
    }
  }
}]
``` */
    #[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<RelatedArtifact>>,
    /// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 */
    #[serde(rename = "mode")]
    pub mode: CodeableConcept,
    /// 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>,
    /** **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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **[DocumentEventType](http://terminology.hl7.org/ValueSet/v3-ActCode); The event(s) being documented, as code(s), reference(s), or both**

 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 case the procedure being documented is necessarily a "History and Physical" act. The events may be included as a code or as a reference to an other resource.

 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 events 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 = "detail")]
    pub detail: Vec<Option<CodeableReference>>,
    /// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Who and/or what authored the section**

 Identifies who is responsible for the information in this section, not necessarily who typed it in.

 */
    #[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 the section is about, when it is not about the subject of composition**

 The actual focus of the section when it is not the subject of the composition, but instead represents something or someone associated with the subject such as (for a patient subject) a spouse, parent, fetus, or donor. If not focus is specified, the focus is assumed to be focus of the parent section, or, for a section in the Composition itself, the subject of the composition. Sections with a focus SHALL only include resources where the logical subject (patient, subject, focus, etc.) matches the section focus, or the resources have no logical subject (few resources).

 Typically, sections in a doument are about the subject of the document, whether that is a  patient, or group of patients, location, or device, or whatever. For some kind of documents, some sections actually contain data about related entities. Typical examples are  a section in a newborn discharge summary concerning the mother, or family history documents, with a section about each family member, though there are many other examples. */
    #[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>,
    /** **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>,
    /** **[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()
    }
}
/** A statement of relationships from one set of concepts to one or more other concepts - either concepts in code systems, or data element/data element concepts, or classes in class models.

 **[ConceptMap](http://hl7.org/fhir/StructureDefinition/ConceptMap) v5.0.0**

 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 concepts in code systems, or data element/data element concepts, or classes in class models.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ConceptMap(pub Box<ConceptMapInner>);
/** A statement of relationships from one set of concepts to one or more other concepts - either concepts in code systems, or data element/data element concepts, or classes in class models.

 **[ConceptMap](http://hl7.org/fhir/StructureDefinition/ConceptMap) v5.0.0**

 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 concepts in code systems, or data element/data element concepts, 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this concept map, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this concept map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the concept map is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then identify this concept 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 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 reference to a particular business version of the concept map with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which ConceptMap is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ConceptMapVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ConceptMapVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 maps that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the concept map was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate concept map instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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.

 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the ConceptMap 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ConceptMap was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ConceptMap is expected to be used**

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

 The effective period for a ConceptMap  determines when the content is applicable for usage and is independent of publication and review dates. For example, a map intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptions related to the content of the ConceptMap. Topics provide a high-level categorization as well as keywords for the ConceptMap that can be useful for filtering and searching.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the ConceptMap**

 An individiual or organization primarily involved in the creation and maintenance of the ConceptMap.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the ConceptMap**

 An individual or organization primarily responsible for internal coherence of the ConceptMap.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the ConceptMap**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the ConceptMap.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the ConceptMap**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the ConceptMap for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, dependencies, bibliographic references, and predecessor and successor artifacts.

 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>>,
    /** **Additional properties of the mapping**

 A property defines a slot through which additional information can be provided about a map from source -> target.

 Properties may be used to supply for example, mapping priority, provenance, presentation hints, flag as experimental, and additional documentation. Multiple occurrences of ConceptMap.group.element.target.property may occur for a ConceptMap.property where ConceptMap.group.element.target.property.code is the same and the values in ConceptMap.group.element.target.property.value differ. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<ConceptMapProperty>>,
    /// 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>>,
    /** **Definition of an additional attribute to act as a data source or target**

 An additionalAttribute defines an additional data element found in the source or target data model where the data will come from or be mapped to. Some mappings are based on data in addition to the source data element, where codes in multiple fields are combined to a single field (or vice versa).

 Additional attributes are used to define additional data elements where mapping data can be found. For an example, see [Specimen Type v2 -> SNOMED CT Mapping(conceptmap-example-specimen-type.html) */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additionalAttribute")]
    pub additional_attribute: Vec<Option<ConceptMapAdditionalAttribute>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_additionalAttribute")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub additional_attribute_ext: Vec<Option<FieldExtension>>,
    /** **The source value set that contains the concepts that are being mapped**

 Identifier for the source value set that contains the concepts that are being mapped and provides context for the mappings.  Limits the scope of the map to source codes (ConceptMap.group.element code or valueSet) that are members of this value set.

 Should be a version specific reference. URIs SHOULD be absolute. If there is no sourceScope or targetScope value set, there is no specified context for the map (not recommended).  The sourceScope value set may select codes from either an explicit (standard or local) or implicit code system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source_scope: Option<ConceptMapSourceScope>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_scope_ext: Option<ConceptMapSourceScopeExtension>,
    /** **The target value set which provides context for the mappings**

 Identifier for the target value set that provides important context about how the mapping choices are made.  Limits the scope of the map to target codes (ConceptMap.group.element.target code or valueSet) that are members of this value set.

 Should be a version specific reference. URIs SHOULD be absolute. If there is no sourceScope or targetScope value set, there is no specified context for the map (not recommended).  The targetScope value set may select codes from either an explicit (standard or local) or implicit code system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub target_scope: Option<ConceptMapTargetScope>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_scope_ext: Option<ConceptMapTargetScopeExtension>,
    /** **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 versionAlgorithm[x] field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ConceptMapVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the property 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 = "ConceptMapPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapProperty {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 mappings, and when referred to in the $translate operation**

 A code that is used to identify the property. The code is used internally (in ConceptMap.group.element.target.property.code) and also in the $translate operation.

 */
    #[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.

 */
    #[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/conceptmap-property-type); Coding | string | integer | boolean | dateTime | decimal | code**

 The type of the property value.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ConceptMapPropertyType,
    /// 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 CodeSystem from which code values come**

 The CodeSystem that defines the codes from which values of type ```textcode``` in property values.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConceptMapProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapPropertyBuilder {
        ConceptMapPropertyBuilder::default()
    }
}
/// Sub-fields of the additionalAttribute 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 = "ConceptMapAdditionalAttributeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapAdditionalAttribute {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 additional attribute through this resource**

 A code that is used to identify this additional data attribute. The code is used internally in ConceptMap.group.element.target.dependsOn.attribute and ConceptMap.group.element.target.product.attribute.

 */
    #[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 data element referred to in this attribte**

 Reference to the formal definition of the source/target data element. For elements defined by the FHIR specification, or using a FHIR logical model, the correct format is {canonical-url}#{element-id}.

 */
    #[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 additional attribute is defined, and/or what the data element it refers to is**

 A description of the additional attribute and/or the data element it refers to - why it is defined, and how the value might be used in mappings, and a discussion of issues associated with the use of the data element.

 */
    #[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>,
    /** **[ConceptMapmapAttributeType](http://hl7.org/fhir/ValueSet/conceptmap-attribute-type); code | Coding | string | boolean | Quantity**

 The type of the source data contained in this concept map for this data element.

 When the source or target is not content defined by FHIR, some additional application logic might be required to map from the FHIR Datatype to the externally defined content */
    #[serde(rename = "type")]
    pub r#type: codes::ConceptMapAttributeType,
    /// 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 ConceptMapAdditionalAttribute {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapAdditionalAttributeBuilder {
        ConceptMapAdditionalAttributeBuilder::default()
    }
}
/// Choice of types for the sourceScope[x] field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapSourceScope {
    /// Variant accepting the Uri type.
    #[serde(rename = "sourceScopeUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "sourceScopeCanonical")]
    Canonical(String),
}
/// Extension value for ConceptMapSourceScope.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapSourceScopeExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_sourceScopeUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_sourceScopeCanonical")]
    Canonical(FieldExtension),
}
/// Choice of types for the targetScope[x] field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapTargetScope {
    /// Variant accepting the Uri type.
    #[serde(rename = "targetScopeUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "targetScopeCanonical")]
    Canonical(String),
}
/// Extension value for ConceptMapTargetScope.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapTargetScopeExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_targetScopeUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_targetScopeCanonical")]
    Canonical(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 An absolute URI that identifies the source system where the concepts to be mapped are defined.

 This is not needed if the source value set is specified and it contains concepts from only a single 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>,
    /** **Target system that the concepts are to be mapped to**

 An absolute URI that identifies the target system that the concepts will be mapped to.

 This is not needed if the target value set is specified and it contains concepts from only a single system. The group target may also be omitted if all of the target element relationship values are 'not-related-to'. */
    #[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>,
    /** **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>>,
    /** **What to do when there is no mapping target for the source concept and ConceptMap.group.element.noMap is not true**

 What to do when there is no mapping to a target concept from the source concept and ConceptMap.group.element.noMap is not true. This provides the "default" to be applied when there is no target concept mapping specified or the expansion of ConceptMap.group.element.target.valueSet is empty.

 The 'unmapped' element is ignored if a code is specified to have relationship = not-related-to or if ConceptMap.group.element.noMap = true. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Identifies the set of concepts being mapped**

 The set of concepts from the ConceptMap.group.source code system which are all being mapped to the target as part of this mapping rule.

 If the value set expansion is empty then there are no source concepts to map in this rule. */
    #[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>,
    /** **No mapping to a target concept for this source concept**

 If noMap = true this indicates that no mapping to a target concept exists for this source concept.

 If noMap = true, then the behavior of ConceptMap.group.unmapped (if present) does not apply. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noMap")]
    pub no_map: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_noMap")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub no_map_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 an 'equivalent' mapping. But multiple maps are allowed for several narrower (i.e. source-is-broader-than-target) options, or to assert that other concepts are not related. */
    #[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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Identifies the set of target concepts**

 The set of concepts from the ConceptMap.group.target code system which are all being mapped to as part of this mapping rule. The effect of using this data element is the same as having multiple ConceptMap.group.element.target elements with one for each concept in the ConceptMap.group.element.target.valueSet value set.

 If the the value set expansion is empty then the source concept(s) are unmapped and the behavior of ConceptMap.group.unmapped (if present) applies. */
    #[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>,
    /** **[ConceptMapRelationship](http://hl7.org/fhir/ValueSet/concept-map-relationship); related-to | equivalent | source-is-narrower-than-target | source-is-broader-than-target | not-related-to**

 The relationship between the source and target concepts. The relationship is read from source to target (e.g. source-is-narrower-than-target).

 This element is labeled as a modifier because it may indicate that there is no mapping. */
    #[serde(rename = "relationship")]
    pub relationship: codes::ConceptMapRelationship,
    /// 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>,
    /** **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>,
    /** **Property value for the source -> target mapping**

 A property value for this source -> target mapping.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<ConceptMapGroupElementTargetProperty>>,
    /// 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>>,
    /** **Other properties required for this mapping**

 A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified data attribute 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 data elements that this mapping also produces**

 Product is the output of a ConceptMap that provides additional values that go in other attributes / data elemnts of the target data.

 */
    #[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 property 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 = "ConceptMapGroupElementTargetPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroupElementTargetProperty {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 ConceptMap.property.code**

 A reference to a mapping property defined in ConceptMap.property.

 */
    #[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. If the type chosen for this element is 'code', then the property SHALL be defined in a ConceptMap.property element.

 */
    #[serde(flatten)]
    pub value: ConceptMapGroupElementTargetPropertyValue,
    /// 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<ConceptMapGroupElementTargetPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupElementTargetProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupElementTargetPropertyBuilder {
        ConceptMapGroupElementTargetPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in ConceptMapGroupElementTargetProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapGroupElementTargetPropertyValue {
    /// 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),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
}
/// Extension value for ConceptMapGroupElementTargetPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapGroupElementTargetPropertyValueExtension {
    /// 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),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 reference to a mapping attribute defined in ConceptMap.additionalAttribute**

 A reference to the additional attribute that holds a value the map depends on.

 */
    #[serde(rename = "attribute")]
    pub attribute: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_attribute")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub attribute_ext: Option<FieldExtension>,
    /** **Value of the referenced data element**

 Data element value that the map depends on / produces.

 If the data type is a code, then the code system is .group.source for .dependsOn.valueCode and .group.target for .product.valueCode. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ConceptMapGroupElementTargetDependsOnValue>,
    /// 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<ConceptMapGroupElementTargetDependsOnValueExtension>,
    /** **The mapping depends on a data element with a value from this value set**

 This mapping applies if the data element value is a code from this value set.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupElementTargetDependsOn {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupElementTargetDependsOnBuilder {
        ConceptMapGroupElementTargetDependsOnBuilder::default()
    }
}
/// Choice of types for the value[x] field in ConceptMapGroupElementTargetDependsOn
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapGroupElementTargetDependsOnValue {
    /// 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 Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
}
/// Extension value for ConceptMapGroupElementTargetDependsOnValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapGroupElementTargetDependsOnValueExtension {
    /// 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 Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); use-source-code | fixed | other-map**

 Defines which action to take if there is no match for the source concept in the target system designated for the group. One of 3 actions are possible: use the unmapped source 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>,
    /** **Fixed code set when mode = fixed**

 The set of fixed codes to use when the mode = 'fixed'  - all unmapped codes are mapped to each of the fixed codes.

 */
    #[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>,
    /** **[UnmappedConceptMapRelationship](http://hl7.org/fhir/ValueSet/concept-map-relationship); related-to | equivalent | source-is-narrower-than-target | source-is-broader-than-target | not-related-to**

 The default relationship value to apply between the source and target concepts when the source code is unmapped and the mode is 'fixed' or 'use-source-code'.

 This element is labeled as a modifier because it may indicate that there is no mapping. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<codes::ConceptMapRelationship>,
    /// 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>,
    /** **canonical reference to an additional ConceptMap to use for mapping if the source concept is unmapped**

 The canonical reference to an additional ConceptMap resource instance to use for mapping if this ConceptMap resource contains no matching mapping for the source concept.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "otherMap")]
    pub other_map: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_otherMap")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub other_map_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupUnmapped {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupUnmappedBuilder {
        ConceptMapGroupUnmappedBuilder::default()
    }
}
/** A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.

 **[Condition](http://hl7.org/fhir/StructureDefinition/Condition) v5.0.0**

 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>);
/** A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.

 **[Condition](http://hl7.org/fhir/StructureDefinition/Condition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this condition by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[ConditionClinicalStatus](http://hl7.org/fhir/ValueSet/condition-clinical); active | recurrence | relapse | inactive | remission | resolved | unknown**

 The clinical status of the condition.

 The data type is CodeableConcept because clinicalStatus has some clinical judgment involved, such that there might need to be more specificity than the required FHIR value set allows. For example, a SNOMED coding might allow for additional specificity.  clinicalStatus is required since it is a modifier element.  For conditions that are problems list items, the clinicalStatus should not be unknown.  For conditions that are not problem list items, the clinicalStatus may be unknown.  For example, conditions derived from a claim are point in time, so those conditions may have a clinicalStatus of unknown */
    #[serde(rename = "clinicalStatus")]
    pub clinical_status: CodeableConcept,
    /// 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); unconfirmed | provisional | differential | confirmed | refuted | entered-in-error**

 The verification status to support the clinical status of the condition.  The verification status pertains to the condition, itself, not to any specific condition attribute.

 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.
The data type is CodeableConcept because verificationStatus has some clinical judgment involved, such that there might need to be more specificity than the required FHIR value set allows. For example, a SNOMED coding might allow for additional specificity. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verificationStatus")]
    pub verification_status: Option<CodeableConcept>,
    /// 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 BodyStructure resource (e.g. to identify and track separately) then use the standard extension [http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extensions/StructureDefinition-bodySite.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>,
    /** **The Encounter during which this Condition was created**

 The Encounter during which this Condition was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. 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 = "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>,
    /** **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.  Period is generally used to convey an imprecise onset that occurred within the time period.  For example, Period is not intended to convey the transition period before the chronic bronchitis or COPD condition was diagnosed, but Period can be used to convey an imprecise diagnosis date.  Range is generally used to convey an imprecise age range (e.g. 4 to 6 years old).  Because a Condition.code can represent multiple levels of granularity and can be modified over time, the onset and abatement dates can have ambiguity whether those dates apply to the current Condition.code or an earlier representation of that Condition.code.   For example, if the Condition.code was initially documented as severe asthma, then it is ambiguous whether the onset and abatement dates apply to asthma (overall in that subject's lifetime) or when asthma transitioned to become severe. */
    #[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>,
    /** **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" - Some conditions, such as chronic 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.
Because a Condition.code can represent multiple levels of granularity and can be modified over time, the onset and abatement dates can have ambiguity whether those dates apply to the current Condition.code or an earlier representation of that Condition.code.   For example, if the Condition.code was initially documented as severe asthma, then it is ambiguous whether the onset and abatement dates apply to asthma (overall in that subject's lifetime) or when asthma transitioned to become severe. */
    #[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 condition was first recorded**

 The recordedDate represents when this particular Condition record was created in the system, which is often a system-generated date.

 When onset date is unknown, recordedDate can be used to establish if the condition was present on or before a given date.  If the recordedDate is known and provided by a sending system, it is preferred that the receiving system preserve that recordedDate value. If the recordedDate is not provided by the sending system, the receipt timestamp is sometimes used as the recordedDate. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recordedDate")]
    pub recorded_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recordedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_date_ext: Option<FieldExtension>,
    /** **Who or what participated in the activities related to the condition and how they were involved**

 Indicates who or what participated in the activities related to the condition and how they were involved.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<ConditionParticipant>>,
    /// 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>>,
    /** **Stage/grade, usually assessed formally**

 A simple summary of the stage such as "Stage 3" or "Early Onset". The determination of the stage is disease-specific, such as cancer, retinopathy of prematurity, kidney diseases, Alzheimer's, or Parkinson disease.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stage")]
    pub stage: Vec<Option<ConditionStage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_stage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub stage_ext: Vec<Option<FieldExtension>>,
    /** **[ManifestationOrSymptom](http://hl7.org/fhir/ValueSet/clinical-findings); Supporting evidence for the verification status**

 Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition.

 If the condition was confirmed, but subsequently refuted, then the evidence can be cumulative including all evidence over time.  The evidence may be a simple list of coded symptoms/manifestations, or references to observations or formal assessments, or both.  For example, if the Condition.code is pneumonia, then there could be an evidence list where Condition.evidence.concept = fever (CodeableConcept), Condition.evidence.concept = cough (CodeableConcept), and Condition.evidence.reference = bronchitis (reference to Condition).  */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evidence")]
    pub evidence: Vec<Option<CodeableReference>>,
    /// 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 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 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 participant 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 = "ConditionParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionParticipant {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Distinguishes the type of involvement of the actor in the activities related to the condition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who or what participated in the activities related to the condition**

 Indicates who or what participated in the activities related to the condition.

 */
    #[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 ConditionParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionParticipantBuilder {
        ConditionParticipantBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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" or "Early Onset". The determination of the stage is disease-specific, such as cancer, retinopathy of prematurity, kidney diseases, Alzheimer's, or Parkinson disease.

 */
    #[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>>,
    /** **[ConditionStageType](http://hl7.org/fhir/ValueSet/condition-stage-type); Kind of staging**

 The kind of staging, such as pathological or clinical staging.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConditionStage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionStageBuilder {
        ConditionStageBuilder::default()
    }
}
/** A definition of a condition and information relevant to managing it.

 **[ConditionDefinition](http://hl7.org/fhir/StructureDefinition/ConditionDefinition) v5.0.0**

 A definition of a condition

 A definition of a condition and information relevant to managing it.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ConditionDefinition(pub Box<ConditionDefinitionInner>);
/** A definition of a condition and information relevant to managing it.

 **[ConditionDefinition](http://hl7.org/fhir/StructureDefinition/ConditionDefinition) v5.0.0**

 A definition of a condition

 A definition of a condition and information relevant to managing it.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ConditionDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ConditionDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ConditionDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this condition definition, represented as a URI (globally unique)**

 An absolute URI that is used to identify this condition definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this condition definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the condition definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 condition definition**

 A formal identifier that is used to identify this condition 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, and can then identify this condition 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 condition definition**

 The identifier that is used to identify this version of the condition definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the condition 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 condition definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the condition definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ConditionDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ConditionDefinitionVersionAlgorithmExtension>,
    /** **Name for this condition definition (computer friendly)**

 A natural language name identifying the condition 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 alphanumeric type name to ensure that it is machine-processing 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 condition definition (human friendly)**

 A short, descriptive, user-friendly title for the condition 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>,
    /** **Subordinate title of the event definition**

 An explanatory or alternate title for the event definition giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

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

 Allows filtering of condition definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 condition definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of condition definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the condition definition was last significantly changed. The date must change 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 condition definition changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the condition definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the condition definition.

 Usually an organization but may be an individual. The publisher (or steward) of the condition definition is the organization or individual primarily responsible for the maintenance and upkeep of the condition 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 condition 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 condition definition**

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

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the condition 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 condition definition is presumed to be the predominant language in the place the condition definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate condition definition instances.

 When multiple useContexts are specified, there is no expectation that 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 condition definition (if applicable)**

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

 It may be possible for the condition definition to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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>>,
    /** **[ConditionKind](http://hl7.org/fhir/ValueSet/condition-code); Identification of the condition, problem or diagnosis**

 Identification of the condition, problem or diagnosis.

 */
    #[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>,
    /** **[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>,
    /** **[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 ConditionDefinition.code. If the use case requires attributes from the BodySite resource (e.g. to identify and track separately) then use the standard extension [http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extensions/StructureDefinition-bodySite.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 = "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>,
    /** **[ConditionStage](http://hl7.org/fhir/ValueSet/condition-stage); 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<CodeableConcept>,
    /// 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>,
    /** **Whether Severity is appropriate**

 Whether Severity is appropriate to collect for this condition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasSeverity")]
    pub has_severity: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hasSeverity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub has_severity_ext: Option<FieldExtension>,
    /** **Whether bodySite is appropriate**

 Whether bodySite is appropriate to collect for this condition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasBodySite")]
    pub has_body_site: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hasBodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub has_body_site_ext: Option<FieldExtension>,
    /** **Whether stage is appropriate**

 Whether stage is appropriate to collect for this condition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasStage")]
    pub has_stage: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hasStage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub has_stage_ext: Option<FieldExtension>,
    /** **Formal Definition for the condition**

 Formal definitions of the condition. These may be references to ontologies, published clinical protocols or research papers.

 */
    #[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>>,
    /** **Observations particularly relevant to this condition**

 Observations particularly relevant to this condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observation")]
    pub observation: Vec<Option<ConditionDefinitionObservation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_observation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub observation_ext: Vec<Option<FieldExtension>>,
    /** **Medications particularly relevant for this condition**

 Medications particularly relevant for this condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "medication")]
    pub medication: Vec<Option<ConditionDefinitionMedication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_medication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub medication_ext: Vec<Option<FieldExtension>>,
    /** **Observation that suggets this condition**

 An observation that suggests that this condition applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "precondition")]
    pub precondition: Vec<Option<ConditionDefinitionPrecondition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_precondition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub precondition_ext: Vec<Option<FieldExtension>>,
    /** **Appropriate team for this condition**

 Appropriate team for this condition.

 */
    #[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>>,
    /** **Questionnaire for this condition**

 Questionnaire for this condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "questionnaire")]
    pub questionnaire: Vec<Option<ConditionDefinitionQuestionnaire>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_questionnaire")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub questionnaire_ext: Vec<Option<FieldExtension>>,
    /** **Plan that is appropriate**

 Plan that is appropriate.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plan")]
    pub plan: Vec<Option<ConditionDefinitionPlan>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_plan")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub plan_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConditionDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ConditionDefinition", ".")]
    pub fn build(self) -> Result<ConditionDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ConditionDefinitionInner> for ConditionDefinition {
    fn from(inner: ConditionDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ConditionDefinition {
    type Target = ConditionDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ConditionDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ConditionDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ConditionDefinitionBuilder {
        ConditionDefinitionBuilder::default()
    }
}
impl ConditionDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ConditionDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ConditionDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the observation field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionObservationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionDefinitionObservation {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Category that is relevant.

 */
    #[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>,
    /** **[ObservationCode](http://hl7.org/fhir/ValueSet/observation-codes); Code for relevant Observation**

 Code for relevant Observation.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConditionDefinitionObservation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionDefinitionObservationBuilder {
        ConditionDefinitionObservationBuilder::default()
    }
}
/// Sub-fields of the medication field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionMedicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionDefinitionMedication {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Category that is relevant.

 */
    #[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>,
    /** **[MedicationCode](http://hl7.org/fhir/ValueSet/medication-codes); Code for relevant Medication**

 Code for relevant Medication.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConditionDefinitionMedication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionDefinitionMedicationBuilder {
        ConditionDefinitionMedicationBuilder::default()
    }
}
/// Sub-fields of the precondition field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionPreconditionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionDefinitionPrecondition {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Kind of pre-condition.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ConditionPreconditionType,
    /// 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>,
    /** **[ObservationCode](http://hl7.org/fhir/ValueSet/observation-codes); Code for relevant Observation**

 Code for relevant Observation.

 */
    #[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 of Observation**

 Value of Observation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ConditionDefinitionPreconditionValue>,
    /// 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<ConditionDefinitionPreconditionValueExtension>,
}
#[cfg(feature = "builders")]
impl ConditionDefinitionPrecondition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionDefinitionPreconditionBuilder {
        ConditionDefinitionPreconditionBuilder::default()
    }
}
/// Choice of types for the value[x] field in ConditionDefinitionPrecondition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionDefinitionPreconditionValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
}
/// Extension value for ConditionDefinitionPreconditionValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionDefinitionPreconditionValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
}
/// Sub-fields of the questionnaire field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionQuestionnaireBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionDefinitionQuestionnaire {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Use of the questionnaire.

 */
    #[serde(rename = "purpose")]
    pub purpose: codes::ConditionQuestionnairePurpose,
    /// 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>,
    /** **Specific Questionnaire**

 Specific Questionnaire.

 */
    #[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 ConditionDefinitionQuestionnaire {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionDefinitionQuestionnaireBuilder {
        ConditionDefinitionQuestionnaireBuilder::default()
    }
}
/// Sub-fields of the plan field in ConditionDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionDefinitionPlanBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionDefinitionPlan {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Use for the plan.

 */
    #[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 actual plan**

 The actual plan.

 */
    #[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 ConditionDefinitionPlan {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionDefinitionPlanBuilder {
        ConditionDefinitionPlanBuilder::default()
    }
}
/** A record of a healthcare consumer’s  choices  or choices made on their behalf by a third party, 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.

 **[Consent](http://hl7.org/fhir/StructureDefinition/Consent) v5.0.0**

 A healthcare consumer's  or third party's choices to permit or deny recipients or roles to perform actions for specific purposes and periods of time

 A record of a healthcare consumer’s  choices  or choices made on their behalf by a third party, 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 consent for research participation and data sharing. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Consent(pub Box<ConsentInner>);
/** A record of a healthcare consumer’s  choices  or choices made on their behalf by a third party, 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.

 **[Consent](http://hl7.org/fhir/StructureDefinition/Consent) v5.0.0**

 A healthcare consumer's  or third party's choices to permit or deny recipients or roles to perform actions for specific purposes and periods of time

 A record of a healthcare consumer’s  choices  or choices made on their behalf by a third party, 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 consent for research participation and data sharing. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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 = "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>>,
    /** **[ConsentState](http://hl7.org/fhir/ValueSet/consent-state-codes); draft | active | inactive | not-done | entered-in-error | unknown**

 Indicates the current state of this Consent resource.

 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 practitioner or group of persons to whom this consent applies.

 */
    #[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>,
    /** **Fully executed date of the consent**

 Date the consent instance was agreed to.

 */
    #[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>,
    /** **Effective period for this Consent**

 Effective period for this Consent Resource and all provisions unless specified in that provision.

 */
    #[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 granting rights according to the policy and rules**

 The entity responsible for granting the rights listed in a Consent Directive.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "grantor")]
    pub grantor: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_grantor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub grantor_ext: Vec<Option<FieldExtension>>,
    /** **Who is agreeing to the policy and rules**

 The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.

 In a fully computable consent, both grantee and grantor  will be listed as actors within the consent. The Grantee and Grantor elements are for ease of search only. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "grantee")]
    pub grantee: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_grantee")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub grantee_ext: Vec<Option<FieldExtension>>,
    /** **Consent workflow management**

 The actor that manages the consent through its lifecycle.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manager")]
    pub manager: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manager")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manager_ext: Vec<Option<FieldExtension>>,
    /** **Consent Enforcer**

 The actor that controls/enforces the access according to the consent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "controller")]
    pub controller: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_controller")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub controller_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.

 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceAttachment")]
    pub source_attachment: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sourceAttachment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub source_attachment_ext: Vec<Option<FieldExtension>>,
    /** **Source from which this consent is taken**

 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceReference")]
    pub source_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sourceReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub source_reference_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentRegulatoryBasis](http://hl7.org/fhir/ValueSet/consent-policy); Regulations establishing base Consent**

 A set of codes that indicate the regulatory basis (if any) that this consent supports.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regulatoryBasis")]
    pub regulatory_basis: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_regulatoryBasis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub regulatory_basis_ext: Vec<Option<FieldExtension>>,
    /** **Computable version of the backing policy**

 A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policyBasis")]
    pub policy_basis: Option<ConsentPolicyBasis>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_policyBasis")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub policy_basis_ext: Option<FieldExtension>,
    /** **Human Readable Policy**

 A Reference to the human readable policy explaining the basis for the Consent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policyText")]
    pub policy_text: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_policyText")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub policy_text_ext: Vec<Option<FieldExtension>>,
    /** **Consent Verified by patient or family**

 Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verification")]
    pub verification: Vec<Option<ConsentVerification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_verification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub verification_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentProvisionType](http://hl7.org/fhir/ValueSet/consent-provision-type); deny | permit**

 Action to take - permit or deny - as default.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<codes::ConsentProvisionType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **Constraints to the base Consent.policyRule/Consent.policy**

 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 = "provision")]
    pub provision: Vec<Option<ConsentProvision>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_provision")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub provision_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 policyBasis 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 = "ConsentPolicyBasisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentPolicyBasis {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 backing policy resource**

 A Reference that identifies the policy the organization will enforce for this Consent.

 While any resource may be used, Consent, PlanDefinition and Contract would be most frequent */
    #[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>,
    /** **URL to a computable backing policy**

 A URL that links to a computable version of the policy the organization will enforce for this Consent.

 */
    #[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 ConsentPolicyBasis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentPolicyBasisBuilder {
        ConsentPolicyBasisBuilder::default()
    }
}
/// Sub-fields of the verification 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 = "ConsentVerificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentVerification {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Has the instruction been verified.

 */
    #[serde(rename = "verified")]
    pub verified: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verified")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verified_ext: Option<FieldExtension>,
    /** **[ConsentVerificationType](http://hl7.org/fhir/ValueSet/consent-verification); Business case of verification**

 Extensible list of verification type starting with verification and re-validation.

 This allows the verification element to hold multiple use cases including RelatedPerson verification of the Grantee decision and periodic re-validation of the consent. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verificationType")]
    pub verification_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verificationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verification_type_ext: Option<FieldExtension>,
    /** **Person conducting verification**

 The person who conducted the verification/validation of the Grantor decision.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verifiedBy")]
    pub verified_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verifiedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verified_by_ext: Option<FieldExtension>,
    /** **Person who verified**

 Who verified the instruction (Patient, Relative or other Authorized Person).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verifiedWith")]
    pub verified_with: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verifiedWith")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verified_with_ext: Option<FieldExtension>,
    /** **When consent verified**

 Date(s) verification was collected.

 Allows for history of verification/validation. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verificationDate")]
    pub verification_date: Vec<Option<DateTime>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_verificationDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub verification_date_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConsentVerification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentVerificationBuilder {
        ConsentVerificationBuilder::default()
    }
}
/// Sub-fields of the provision 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 = "ConsentProvisionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentProvision {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Timeframe for this provision.

 This is the bound effective time of the consent and should be in the base provision in the Consent resource. */
    #[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 provision (or group, by role)**

 Who or what is controlled by this provision. 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<ConsentProvisionActor>>,
    /// 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 provision**

 Actions controlled by this provision.

 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-label-examples); Security Labels that define affected resources**

 A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.

 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. When the purpose of use tag is on the data, access request purpose of use shall not conflict. */
    #[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://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Context of activities covered by this provision**

 The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision.

 When the purpose of use tag is on the data, access request purpose of use shall not conflict. */
    #[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, CDA, etc**

 The documentType(s) covered by this provision. The type can be 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 documentType element is that the codes refer to document types defined in a standard somewhere. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentType")]
    pub document_type: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_documentType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub document_type_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentContentClass](http://hl7.org/fhir/ValueSet/resource-types); e.g. Resource Type, Profile, etc**

 The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to.

 Multiple types are or'ed together. The intention of the resourceType 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 = "resourceType")]
    pub resource_type: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resourceType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_type_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 provision applies.

 */
    #[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>>,
    /** **Timeframe for data controlled by this provision**

 Clinical or Operational Relevant period of time that bounds the data controlled by this provision.

 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 provision**

 The resources controlled by this provision 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<ConsentProvisionData>>,
    /// 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>>,
    /** **A computable expression of the consent**

 A computable (FHIRPath or other) definition of what is controlled by this consent.

 Constraining the expression type for a specific implementation via profile is recommended */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<Expression>,
    /// 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>,
    /** **Nested Exception Provisions**

 Provisions which provide exceptions to the base provision or subprovisions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provision")]
    pub provision: Vec<Option<ConsentProvision>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_provision")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub provision_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConsentProvision {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentProvisionBuilder {
        ConsentProvisionBuilder::default()
    }
}
/// Sub-fields of the actor field in ConsentProvision
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentProvisionActorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentProvisionActor {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/participation-role-type); How the actor is involved**

 How the individual is involved in the resources content that is described in the exception.

 */
    #[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>,
    /** **Resource for the actor (or group, by role)**

 The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ConsentProvisionActor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentProvisionActorBuilder {
        ConsentProvisionActorBuilder::default()
    }
}
/// Sub-fields of the data field in ConsentProvision
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentProvisionDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentProvisionData {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 ConsentProvisionData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentProvisionDataBuilder {
        ConsentProvisionDataBuilder::default()
    }
}
/** Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.

 **[Contract](http://hl7.org/fhir/StructureDefinition/Contract) v5.0.0**

 Legal Agreement

 Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Contract(pub Box<ContractInner>);
/** Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.

 **[Contract](http://hl7.org/fhir/StructureDefinition/Contract) v5.0.0**

 Legal Agreement

 Legally enforceable, formally recorded unilateral or bilateral directive i.e., a policy or agreement.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or a derivative that references a Source Contract.

 */
    #[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>>,
    /** **Basal definition**

 Canonical identifier for this contract, represented as a URI (globally unique).

 Used in a domain that uses a supplied contract repository. */
    #[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 edition**

 An edition identifier used for business purposes to label business significant variants.

 Note -  This is a business versionId, not a resource version id (see discussion at [Versioning](resource.html#versions))
Comments - There may be different contract instances that have the same identifier but different versions. The version can be appended to the url in a reference to allow a reference to a particular business version of the plan definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **[ContractStatus](http://hl7.org/fhir/ValueSet/contract-status); amended | appended | cancelled | disputed | entered-in-error | executable +**

 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<codes::ContractStatus>,
    /// 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>,
    /** **[ContractLegalState](http://hl7.org/fhir/ValueSet/contract-legalstate); Negotiation status**

 Legal states of the formation of a legal instrument, which is a formally executed written document that can be formally attributed to its author, records and formally expresses a legally enforceable act, process, or contractual duty, obligation, or right, and therefore evidences that act, process, or agreement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "legalState")]
    pub legal_state: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_legalState")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub legal_state_ext: Option<FieldExtension>,
    /** **Source Contract Definition**

 The URL pointing to a FHIR-defined Contract Definition that is adhered to in whole or part by this Contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_canonical_ext: Option<FieldExtension>,
    /** **External Contract Definition**

 The URL pointing to an externally maintained definition that is adhered to in whole or in part by this Contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_uri_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>,
    /** **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>,
    /** **[ContractExpiration](http://hl7.org/fhir/ValueSet/contract-expiration-type); Contract cessation cause**

 Event resulting in discontinuation or termination of this Contract instance by one or more parties to the contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expirationType")]
    pub expiration_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expirationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expiration_type_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>>,
    /** **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>>,
    /** **A sphere of control governed by an authoritative jurisdiction, organization, or person**

 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>>,
    /** **Specific Location**

 Sites in which the contract is complied with,  exercised, or in force.

 */
    #[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>>,
    /** **Computer friendly designation**

 A natural language name identifying this Contract definition, derivative, or instance in any legal state. Provides additional information about its content. 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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Human Friendly name**

 A short, descriptive, user-friendly title for this Contract definition, derivative, or instance in any legal state.

 */
    #[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>,
    /** **Subordinate Friendly name**

 A more detailed or qualifying explanatory or alternate user-friendly title for this Contract definition, derivative, or instance in any legal state.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_ext: Option<FieldExtension>,
    /** **Acronym or short name**

 Alternative representation of the title for this Contract definition, derivative, or instance in any legal state., e.g., a domain specific contract number related to legislation.

 */
    #[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>>,
    /** **Source of Contract**

 The individual or organization that authored the Contract definition, derivative, or instance in any legal state.

 */
    #[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>,
    /** **[ContractScope](http://hl7.org/fhir/ValueSet/contract-scope); Range of Legal Concerns**

 A selector of legal concerns for this Contract definition, derivative, or instance in any legal state.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scope_ext: Option<FieldExtension>,
    /** **Focus of contract interest**

 Narrows the range of legal concerns to focus on the achievement of specific contractual objectives.

 Contractual areas of concern are very broad. This element supports narrowing the area of concern to more specific term topics within this Contract. Given the wide range of contract topics, implementers need to be cognizant of the business use case for which they are designing a FHIR Contract, and narrowly specify the topic being represented with respect to the Contract.type and any specializing Contract.subtype. The same topic, e.g., an asset such as a good or service, such as a real property, medical supply, insurance, information, a procedure or employment, or a manner of conduct, such adherence to a privacy, trust, or security policy, may be the topic of multiple types of contracts.
One way to determine the Contract.topic is to answer the question: "What is the overall objective of this legal instrument?". The Contract.topic is described with more detail by the terms of the Contract. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub topic: Option<ContractTopic>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_ext: Option<ContractTopicExtension>,
    /** **[ContractType](http://hl7.org/fhir/ValueSet/contract-type); Legal instrument category**

 A high-level category for the legal instrument, whether constructed as a Contract definition, derivative, or instance in any legal state.  Provides additional information about its content within the context of the Contract's scope to distinguish the kinds of systems that would be interested in the contract.

 */
    #[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**

 Sub-category for the Contract that distinguishes the kinds of systems that would be interested in the Contract within the context of the Contract's scope.

 */
    #[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>>,
    /** **Contract precursor content**

 Precusory content developed with a focus and intent of supporting the formation a Contract instance, which may be associated with and transformable into a Contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contentDefinition")]
    pub content_definition: Option<ContractContentDefinition>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contentDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_definition_ext: 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>>,
    /** **Extra Information**

 Information that may be needed by/relevant to the performer in their execution of this term action.

 */
    #[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>>,
    /** **Key event in Contract History**

 Links to Provenance records for past versions of this Contract definition, derivative, or instance, which identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the Contract.  The Provenance.entity indicates the target that was changed in the update (see [Provenance.entity](provenance-definitions.html#Provenance.entity)).

 */
    #[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>>,
    /** **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 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>>,
    /** **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 legally_binding: Option<ContractLegallyBinding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub legally_binding_ext: Option<ContractLegallyBindingExtension>,
}
#[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
    }
}
/// Choice of types for the topic[x] field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTopic {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "topicCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "topicReference")]
    Reference(Reference),
}
/// Extension value for ContractTopic.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTopicExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_topicCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_topicReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the contentDefinition 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 = "ContractContentDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractContentDefinition {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Precusory content structure and use, i.e., a boilerplate, template, application for a contract such as an insurance policy or benefits under a program, e.g., workers compensation.

 */
    #[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>,
    /** **[ContractDefinitionSubtype](http://hl7.org/fhir/ValueSet/contract-definition-subtype); Detailed Content Type Definition**

 Detailed Precusory content type.

 */
    #[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>,
    /** **Publisher Entity**

 The  individual or organization that published the Contract precursor content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<Reference>,
    /// 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>,
    /** **When published**

 The date (and optionally time) when the contract was last significantly changed. The date must change 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 contract changes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publicationDate")]
    pub publication_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publicationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publication_date_ext: Option<FieldExtension>,
    /** **[ContractPublicationStatus](http://hl7.org/fhir/ValueSet/contract-publicationstatus); amended | appended | cancelled | disputed | entered-in-error | executable +**

 amended | appended | cancelled | disputed | entered-in-error | executable +.

 */
    #[serde(rename = "publicationStatus")]
    pub publication_status: codes::ContractPublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publicationStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publication_status_ext: Option<FieldExtension>,
    /** **Publication Ownership**

 A copyright statement relating to Contract precursor content. Copyright statements are generally legal restrictions on the use and publishing of the Contract precursor content.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ContractContentDefinition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractContentDefinitionBuilder {
        ContractContentDefinitionBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Term Concern**

 The entity that the term applies to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub topic: Option<ContractTermTopic>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_ext: Option<ContractTermTopicExtension>,
    /** **[ContractTermType](http://hl7.org/fhir/ValueSet/contract-term-type); Contract Term Type or Form**

 A legal clause or condition contained within a contract that requires one or both parties to perform a particular requirement by some specified time or prevents one or both parties from performing a particular requirement by some specified time.

 */
    #[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**

 A specialized legal clause or condition based on overarching contract type.

 */
    #[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>,
    /** **Term Statement**

 Statement of a provision in a policy or a contract.

 */
    #[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>,
    /** **Protection for the Term**

 Security labels that protect the handling of information about the term and its elements, which may be specifically identified.

 Within a Contract, a security label may apply to the one to many nested group of terms or to a term, whether inside a group or a singleton.  The security label on the entire set of term provision elements may be different from the security labels on a contained offer, asset, valuedItem, or data such as sensitive information, and must be the high water mark of all security labels within the term. Rationale is that a labelled term, which may be disaggregated from the Contract, and must persist the label on the term and on contained elements within other contexts. If more than one policy dictates a level of confidentiality of the term, then each applicable policy may be represented by a security label specific to its requirements.

A Security Label is comprised of 1..1 confidentiality code and 0..* other security label codes (aka "privacy tags". A Security Label is metadata assigned (aka "tagged") to Resources and Resource elements, which specify the confidentiality and sensitivity of the Resource or element and their related attributes, the purposes for which tagged items may be collected, access, used or disclosed, any limitation on the type of entities authorized to engage in permitted purposes, and handling instructions that obligate or prohibit certain actions on the tagged items. */
    #[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<ContractTermSecurityLabel>>,
    /// 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>>,
    /** **Context of the Contract term**

 The matter of concern in the context of this provision of the agrement.

 */
    #[serde(rename = "offer")]
    pub offer: ContractTermOffer,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_offer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub offer_ext: Option<FieldExtension>,
    /** **Contract Term Asset List**

 Contract Term Asset List.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asset")]
    pub asset: Vec<Option<ContractTermAsset>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_asset")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub asset_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 = "action")]
    pub action: Vec<Option<ContractTermAction>>,
    /// 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>>,
    /** **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()
    }
}
/// Choice of types for the topic[x] field in ContractTerm
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermTopic {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "topicCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "topicReference")]
    Reference(Reference),
}
/// Extension value for ContractTermTopic.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermTopicExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_topicCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_topicReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the securityLabel 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 = "ContractTermSecurityLabelBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermSecurityLabel {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Number used to link this term or term element to the applicable Security Label.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Vec<Option<u32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_number")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub number_ext: Vec<Option<FieldExtension>>,
    /** **[ContractSecurityClassification](http://hl7.org/fhir/ValueSet/contract-security-classification); Confidentiality Protection**

 Security label privacy tag that specifies the level of confidentiality protection required for this term and/or term elements.

 */
    #[serde(rename = "classification")]
    pub classification: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub classification_ext: Option<FieldExtension>,
    /** **[ContractSecurityCategory](http://hl7.org/fhir/ValueSet/contract-security-category); Applicable Policy**

 Security label privacy tag that specifies the applicable privacy and security policies governing this term and/or term elements.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<Coding>>,
    /// 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>>,
    /** **[ContractSecurityControl](http://hl7.org/fhir/ValueSet/contract-security-control); Handling Instructions**

 Security label privacy tag that specifies the manner in which term and/or term elements are to be protected.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "control")]
    pub control: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_control")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub control_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTermSecurityLabel {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermSecurityLabelBuilder {
        ContractTermSecurityLabelBuilder::default()
    }
}
/// Sub-fields of the offer 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 = "ContractTermOfferBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermOffer {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Unique identifier for this particular Contract Provision.

 */
    #[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>>,
    /** **Offer Recipient**

 Offer Recipient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "party")]
    pub party: Vec<Option<ContractTermOfferParty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub party_ext: Vec<Option<FieldExtension>>,
    /** **Negotiable offer asset**

 The owner of an asset has the residual control rights over the asset: the right to decide all usages of the asset in any way not inconsistent with a prior contract, custom, or law (Hart, 1995, p. 30).

 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 = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_ext: Option<FieldExtension>,
    /** **[ContractTermType](http://hl7.org/fhir/ValueSet/contract-term-type); Contract Offer 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>,
    /** **[ContractDecisionType](http://terminology.hl7.org/ValueSet/v3-ActConsentDirective); Accepting party choice**

 Type of choice made by accepting party with respect to an offer made by an offeror/ grantee.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **[ContractDecisionMode](http://hl7.org/fhir/ValueSet/contract-decision-mode); How decision is conveyed**

 How the decision about a Contract was conveyed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decisionMode")]
    pub decision_mode: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_decisionMode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub decision_mode_ext: Vec<Option<FieldExtension>>,
    /** **Response to offer text**

 Response to offer text.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "answer")]
    pub answer: Vec<Option<ContractTermOfferAnswer>>,
    /// 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>>,
    /** **Human readable offer text**

 Human readable form of this Contract Offer.

 */
    #[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>,
    /** **Pointer to text**

 The id of the clause or question text of the offer in the referenced questionnaire/response.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_id_ext: Vec<Option<FieldExtension>>,
    /** **Offer restriction numbers**

 Security labels that protects the offer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabelNumber")]
    pub security_label_number: Vec<Option<u32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabelNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_number_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTermOffer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermOfferBuilder {
        ContractTermOfferBuilder::default()
    }
}
/// Sub-fields of the party field in ContractTermOffer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermOfferPartyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermOfferParty {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Participant in the offer.

 */
    #[serde(rename = "reference")]
    pub reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<Option<FieldExtension>>,
    /** **[ContractPartyRole](http://hl7.org/fhir/ValueSet/contract-party-role); Participant engagement type**

 How the party participates in the offer.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ContractTermOfferParty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermOfferPartyBuilder {
        ContractTermOfferPartyBuilder::default()
    }
}
/// Sub-fields of the answer field in ContractTermOffer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermOfferAnswerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermOfferAnswer {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 actual answer response**

 Response to an offer clause or question text,  which enables selection of values to be agreed to, e.g., the period of participation, the date of occupancy of a rental, warranty duration, or whether biospecimen may be used for further research.

 */
    #[serde(flatten)]
    pub value: ContractTermOfferAnswerValue,
    /// 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<ContractTermOfferAnswerValueExtension>,
}
#[cfg(feature = "builders")]
impl ContractTermOfferAnswer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermOfferAnswerBuilder {
        ContractTermOfferAnswerBuilder::default()
    }
}
/// Choice of types for the value[x] field in ContractTermOfferAnswer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermOfferAnswerValue {
    /// 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 ContractTermOfferAnswerValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermOfferAnswerValueExtension {
    /// 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),
}
/// Sub-fields of the asset 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 = "ContractTermAssetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermAsset {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Differentiates the kind of the asset .

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scope_ext: Option<FieldExtension>,
    /** **[ContractAssetType](http://hl7.org/fhir/ValueSet/contract-assettype); Asset category**

 Target entity type about which the term may be concerned.

 */
    #[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>>,
    /** **Associated entities**

 Associated entities.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeReference")]
    pub type_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_typeReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub type_reference_ext: Vec<Option<FieldExtension>>,
    /** **[ContractAssetSubtype](http://hl7.org/fhir/ValueSet/contract-assetsubtype); Asset sub-category**

 May be a subtype or part of an offered asset.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtype")]
    pub subtype: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[ConsentContentClass](http://hl7.org/fhir/ValueSet/consent-content-class); Kinship of the asset**

 Specifies the applicability of the term to an asset resource instance, and instances it refers to or instances that refer to it, and/or are owned by the offeree.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<Coding>,
    /// 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>,
    /** **Circumstance of the asset**

 Circumstance of the asset.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Vec<Option<ContractTermAssetContext>>,
    /// 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>>,
    /** **Quality desctiption of asset**

 Description of the quality and completeness of the asset that may be a factor in its valuation.

 */
    #[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>,
    /** **[AssetAvailabilityType](http://hl7.org/fhir/ValueSet/asset-availability); Asset availability types**

 Type of Asset availability for use or ownership.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "periodType")]
    pub period_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_periodType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub period_type_ext: Vec<Option<FieldExtension>>,
    /** **Time period of the asset**

 Asset relevant contractual time period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub period_ext: Vec<Option<FieldExtension>>,
    /** **Time period**

 Time period of asset use.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usePeriod")]
    pub use_period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_usePeriod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_period_ext: Vec<Option<FieldExtension>>,
    /** **Asset clause or question text**

 Clause or question text (Prose Object) concerning the asset in a linked form, such as a QuestionnaireResponse used in the formation of the contract.

 */
    #[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>,
    /** **Pointer to asset text**

 Id [identifier??] of the clause or question text about the asset in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_id_ext: Vec<Option<FieldExtension>>,
    /** **Response to assets**

 Response to assets.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "answer")]
    pub answer: Vec<Option<ContractTermOfferAnswer>>,
    /// 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>>,
    /** **Asset restriction numbers**

 Security labels that protects the asset.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabelNumber")]
    pub security_label_number: Vec<Option<u32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabelNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_number_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<ContractTermAssetValuedItem>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl ContractTermAsset {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermAssetBuilder {
        ContractTermAssetBuilder::default()
    }
}
/// Sub-fields of the context field in ContractTermAsset
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermAssetContextBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermAssetContext {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Asset context reference may include the creator, custodian, or owning Person or Organization (e.g., bank, repository),  location held, e.g., building,  jurisdiction.

 */
    #[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>,
    /** **[ContractAssetContext](http://hl7.org/fhir/ValueSet/contract-assetcontext); Codeable asset context**

 Coded representation of the context generally or of the Referenced entity, such as the asset holder type or location.

 */
    #[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>>,
    /** **Context description**

 Context description.

 */
    #[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 ContractTermAssetContext {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermAssetContextBuilder {
        ContractTermAssetContextBuilder::default()
    }
}
/// Sub-fields of the valuedItem field in ContractTermAsset
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermAssetValuedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermAssetValuedItem {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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<ContractTermAssetValuedItemEntity>,
    /// 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<ContractTermAssetValuedItemEntityExtension>,
    /** **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>,
    /** **Terms of valuation**

 Terms of valuation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payment")]
    pub payment: Option<String>,
    /// 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>,
    /** **When payment is due**

 When payment is due.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentDate")]
    pub payment_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_date_ext: Option<FieldExtension>,
    /** **Who will make payment**

 Who will make payment.

 */
    #[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>,
    /** **Who will receive payment**

 Who will receive payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recipient_ext: Option<FieldExtension>,
    /** **Pointer to specific item**

 Id  of the clause or question text related to the context of this valuedItem in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_id_ext: Vec<Option<FieldExtension>>,
    /** **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 = "securityLabelNumber")]
    pub security_label_number: Vec<Option<u32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabelNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_number_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTermAssetValuedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermAssetValuedItemBuilder {
        ContractTermAssetValuedItemBuilder::default()
    }
}
/// Choice of types for the entity[x] field in ContractTermAssetValuedItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermAssetValuedItemEntity {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "entityCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "entityReference")]
    Reference(Reference),
}
/// Extension value for ContractTermAssetValuedItemEntity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermAssetValuedItemEntityExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_entityCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_entityReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the action 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 = "ContractTermActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermAction {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 True if the term prohibits the  action.

 */
    #[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>,
    /** **[ContractAction](http://hl7.org/fhir/ValueSet/contract-action); Type or form of the action**

 Activity or service obligation to be done or not done, performed or not performed, effectuated or not by this Contract term.

 */
    #[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>,
    /** **Entity of the action**

 Entity of the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Vec<Option<ContractTermActionSubject>>,
    /// 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>>,
    /** **[ContractActionReason](http://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Purpose for the Contract Term Action**

 Reason or purpose for the action stipulated by this Contract Provision.

 */
    #[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>,
    /** **Pointer to specific item**

 Id [identifier??] of the clause or question text related to this action in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_id_ext: Vec<Option<FieldExtension>>,
    /** **[ContractActionStatus](http://hl7.org/fhir/ValueSet/contract-actionstatus); State of the action**

 Current state of the term action.

 */
    #[serde(rename = "status")]
    pub status: CodeableConcept,
    /// 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>,
    /** **Episode associated with action**

 Encounter or Episode with primary association to the specified term activity.

 */
    #[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>,
    /** **Pointer to specific item**

 Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contextLinkId")]
    pub context_link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contextLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub context_link_id_ext: Vec<Option<FieldExtension>>,
    /** **When action happens**

 When action happens.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ContractTermActionOccurrence>,
    /// 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<ContractTermActionOccurrenceExtension>,
    /** **Who asked for action**

 Who or what initiated the action and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requester_ext: Vec<Option<FieldExtension>>,
    /** **Pointer to specific item**

 Id [identifier??] of the clause or question text related to the requester of this action in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requesterLinkId")]
    pub requester_link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requesterLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requester_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[ContractActionPerformerType](http://hl7.org/fhir/ValueSet/participation-role-type); Kind of service performer**

 The type of individual that is desired or required to perform or not perform the action.

 */
    #[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>>,
    /** **[ContractActionPerformerRole](http://hl7.org/fhir/ValueSet/security-role-type); Competency of the performer**

 The type of role or competency of an individual desired or required to perform or not perform the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performerRole")]
    pub performer_role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performerRole")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_role_ext: Option<FieldExtension>,
    /** **Actor that wil execute (or not) the action**

 Indicates who or what is being asked to perform (or not perform) the ction.

 */
    #[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>,
    /** **Pointer to specific item**

 Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performerLinkId")]
    pub performer_link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performerLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[ContractActionReason](http://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Why is action (not) needed?**

 Rationale for the action to be performed or not performed. Describes why the action is permitted or prohibited. Either a coded concept, or another resource whose existence justifies permitting or not permitting this 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<CodeableReference>>,
    /// 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>>,
    /** **Pointer to specific item**

 Id [identifier??] of the clause or question text related to the reason type or reference of this  action in the referenced form or QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonLinkId")]
    pub reason_link_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Comments about the action**

 Comments made about the term action made by the requester, 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>>,
    /** **Action restriction numbers**

 Security labels that protects the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabelNumber")]
    pub security_label_number: Vec<Option<u32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabelNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_number_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTermAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermActionBuilder {
        ContractTermActionBuilder::default()
    }
}
/// Sub-fields of the subject field in ContractTermAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermActionSubjectBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermActionSubject {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The entity the action is performed or not performed on or for.

 */
    #[serde(rename = "reference")]
    pub reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<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 = "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 ContractTermActionSubject {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermActionSubjectBuilder {
        ContractTermActionSubjectBuilder::default()
    }
}
/// Choice of types for the occurrence[x] field in ContractTermAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermActionOccurrence {
    /// 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 ContractTermActionOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermActionOccurrenceExtension {
    /// 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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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),
}
/// Choice of types for the legallyBinding[x] field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractLegallyBinding {
    /// Variant accepting the Attachment type.
    #[serde(rename = "legallyBindingAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "legallyBindingReference")]
    Reference(Reference),
}
/// Extension value for ContractLegallyBinding.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractLegallyBindingExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_legallyBindingAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_legallyBindingReference")]
    Reference(FieldExtension),
}
/** Financial instrument which may be used to reimburse or pay for health care products and services. Includes both insurance and self-payment.

 **[Coverage](http://hl7.org/fhir/StructureDefinition/Coverage) v5.0.0**

 Insurance or medical plan or a payment agreement

 Financial instrument which may be used to reimburse or pay for health care products and services. Includes both insurance and self-payment.

 The Coverage resource contains the insurance card level information, which is customary to provide on claims and other communications between providers and insurers. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Coverage(pub Box<CoverageInner>);
/** Financial instrument which may be used to reimburse or pay for health care products and services. Includes both insurance and self-payment.

 **[Coverage](http://hl7.org/fhir/StructureDefinition/Coverage) v5.0.0**

 Insurance or medical plan or a payment agreement

 Financial instrument which may be used to reimburse or pay for health care products and services. Includes both insurance and self-payment.

 The Coverage resource contains the insurance card level information, which is customary to provide on claims and other communications between providers and insurers. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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) for this coverage**

 The identifier of the coverage as issued by the insurer.

 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 concatenation of the Coverage.SubscriberID and the Coverage.dependant. Note that not all insurers issue unique member IDs therefore searches may result in multiple responses. */
    #[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(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>,
    /** **[CoverageKind](http://hl7.org/fhir/ValueSet/coverage-kind); insurance | self-pay | other**

 The nature of the coverage be it insurance, or cash payment such as self-pay.

 */
    #[serde(rename = "kind")]
    pub kind: codes::Kind,
    /// 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>,
    /** **Self-pay parties and responsibility**

 Link to the paying party and optionally what specifically they will be responsible to pay.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentBy")]
    pub payment_by: Vec<Option<CoveragePaymentBy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_paymentBy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payment_by_ext: Vec<Option<FieldExtension>>,
    /** **[CoverageType](http://hl7.org/fhir/ValueSet/coverage-type); Coverage category 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.

 For example: 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.

 May be self or a parent in the case of dependants. A subscriber is only required on certain types of policies not all policies and that it is appropriate to have just a policyholder and a beneficiary when not other party can join that policy instance. */
    #[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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subscriberId")]
    pub subscriber_id: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subscriberId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subscriber_id_ext: Vec<Option<FieldExtension>>,
    /** **Plan beneficiary**

 The party who benefits from the insurance coverage; the patient when products and/or services are provided.

 */
    #[serde(rename = "beneficiary")]
    pub beneficiary: 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>,
    /** **Dependent number**

 A designator for a dependent under the coverage.

 Sometimes the member number is constructed from the subscriberId and the dependant number. */
    #[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>,
    /** **[Relationship](http://hl7.org/fhir/ValueSet/subscriber-relationship); Beneficiary relationship to the subscriber**

 The relationship of beneficiary (patient) to the subscriber.

 Typically, an individual uses policies which are theirs (relationship='self') before policies owned by others. */
    #[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>,
    /** **Issuer of the policy**

 The program or plan underwriter, payor, insurance company.

 May provide multiple identifiers such as insurance company identifier or business identifier (BIN number). */
    #[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>,
    /** **Additional coverage classifications**

 A suite of underwriter specific classifiers.

 For example, class may be used to identify a class of coverage or employer group, policy, or plan. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Vec<Option<CoverageClass>>,
    /// 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>>,
    /** **Relative order of the coverage**

 The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care. For example; a patient might have (0) auto insurance (1) their own health insurance and (2) spouse's health insurance. When claiming for treatments which were not the result of an auto accident then only coverages (1) and (2) above would be applicatble and would apply in the order specified in parenthesis.

 */
    #[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>,
    /** **Patient payments for services/products**

 A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card.

 For example by knowing the patient visit co-pay, the provider can collect the amount prior to undertaking treatment. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "costToBeneficiary")]
    pub cost_to_beneficiary: Vec<Option<CoverageCostToBeneficiary>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_costToBeneficiary")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub cost_to_beneficiary_ext: Vec<Option<FieldExtension>>,
    /** **Reimbursement to insurer**

 When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.

 Typically, automotive and worker's compensation policies would be flagged with 'subrogation=true' to enable healthcare payors to collect against accident claims. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subrogation")]
    pub subrogation: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subrogation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subrogation_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>>,
    /** **Insurance plan details**

 The insurance plan details, benefits and costs, which constitute this insurance coverage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurancePlan")]
    pub insurance_plan: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurancePlan")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurance_plan_ext: 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 paymentBy 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 = "CoveragePaymentByBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoveragePaymentBy {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The list of parties providing non-insurance payment for the treatment costs.

 */
    #[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>,
    /** **Party's responsibility**

  Description of the financial responsibility.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsibility")]
    pub responsibility: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsibility")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsibility_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CoveragePaymentBy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoveragePaymentByBuilder {
        CoveragePaymentByBuilder::default()
    }
}
/// Sub-fields of the class 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 = "CoverageClassBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageClass {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The type of classification for which an insurer-specific class label or number and optional name is provided.  For example, type may be used to identify a class of coverage or employer group, policy, or plan.

 */
    #[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>,
    /** **Value associated with the type**

 The alphanumeric identifier associated with the insurer issued label.

 For example, the Group or Plan number. */
    #[serde(rename = "value")]
    pub value: Identifier,
    /// 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>,
    /** **Human readable description of the type and value**

 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 = "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>,
}
#[cfg(feature = "builders")]
impl CoverageClass {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageClassBuilder {
        CoverageClassBuilder::default()
    }
}
/// Sub-fields of the costToBeneficiary 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 = "CoverageCostToBeneficiaryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageCostToBeneficiary {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The category of patient centric costs associated with treatment.

 For example visit, specialist visits, emergency, inpatient care, 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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>,
    /** **[BenefitNetwork](http://hl7.org/fhir/ValueSet/benefit-network); In or out of network**

 Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.

 */
    #[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**

 Indicates if the benefits apply to an individual or to the 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 visits'.

 */
    #[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>,
    /** **The amount or percentage due from the beneficiary**

 The amount due from the patient for the cost category.

 Amount may be expressed as a percentage of the service/product cost or a fixed amount of currency. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<CoverageCostToBeneficiaryValue>,
    /// 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<CoverageCostToBeneficiaryValueExtension>,
    /** **Exceptions for patient payments**

 A suite of codes indicating exceptions or reductions to patient costs and their effective periods.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exception")]
    pub exception: Vec<Option<CoverageCostToBeneficiaryException>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_exception")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub exception_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CoverageCostToBeneficiary {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageCostToBeneficiaryBuilder {
        CoverageCostToBeneficiaryBuilder::default()
    }
}
/// Choice of types for the value[x] field in CoverageCostToBeneficiary
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageCostToBeneficiaryValue {
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Money type.
    #[serde(rename = "valueMoney")]
    Money(Money),
}
/// Extension value for CoverageCostToBeneficiaryValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageCostToBeneficiaryValueExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_valueMoney")]
    Money(FieldExtension),
}
/// Sub-fields of the exception field in CoverageCostToBeneficiary
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageCostToBeneficiaryExceptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageCostToBeneficiaryException {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The code for the specific exception.

 */
    #[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>,
    /** **The effective period of the exception**

 The timeframe the exception is 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>,
}
#[cfg(feature = "builders")]
impl CoverageCostToBeneficiaryException {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageCostToBeneficiaryExceptionBuilder {
        CoverageCostToBeneficiaryExceptionBuilder::default()
    }
}
/** The CoverageEligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an CoverageEligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.

 **[CoverageEligibilityRequest](http://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequest) v5.0.0**

 CoverageEligibilityRequest resource

 The CoverageEligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an CoverageEligibilityResponse, 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 CoverageEligibilityRequest(pub Box<CoverageEligibilityRequestInner>);
/** The CoverageEligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an CoverageEligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.

 **[CoverageEligibilityRequest](http://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequest) v5.0.0**

 CoverageEligibilityRequest resource

 The CoverageEligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an CoverageEligibilityResponse, 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 = "CoverageEligibilityRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CoverageEligibilityRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CoverageEligibilityRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CoverageEligibilityRequest", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 coverage eligiblity request**

 A unique identifier assigned to this coverage eligiblity 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>>,
    /** **[EligibilityRequestStatus](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(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>,
    /** **[ProcessPriority](http://hl7.org/fhir/ValueSet/process-priority); Desired processing priority**

 When the requestor expects the processor to complete processing.

 */
    #[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>,
    /** **[EligibilityRequestPurpose](http://hl7.org/fhir/ValueSet/eligibilityrequest-purpose); auth-requirements | benefits | discovery | validation**

 Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.

 */
    #[serde(rename = "purpose")]
    pub purpose: Vec<Option<codes::EligibilityRequestPurpose>>,
    /// 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>>,
    /** **Intended recipient of products and services**

 The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.

 1..1. */
    #[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>,
    /** **Event information**

 Information code for an event with a corresponding date or period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<CoverageEligibilityRequestEvent>>,
    /// 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>>,
    /** **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<CoverageEligibilityRequestServiced>,
    /// 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<CoverageEligibilityRequestServicedExtension>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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 request.

 */
    #[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>,
    /** **Party responsible for the request**

 The provider which is responsible for the request.

 Typically this field would be 1..1 where this party is accountable for the data content within the claim but is not necessarily the facility, provider group or practitioner who provided the products and services listed within this claim resource. This field is the Billing Provider, for example, a facility, provider group, lab or practitioner. */
    #[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>,
    /** **Coverage issuer**

 The Insurer who issued the coverage in question and is the recipient of the request.

 */
    #[serde(rename = "insurer")]
    pub insurer: 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 are intended to be 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>,
    /** **Supporting information**

 Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.

 Often there are multiple 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 = "supportingInfo")]
    pub supporting_info: Vec<Option<CoverageEligibilityRequestSupportingInfo>>,
    /// 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>>,
    /** **Patient insurance information**

 Financial instruments for reimbursement for the health care products and services.

 All insurance coverages for the patient which may be applicable for reimbursement, of the products and services listed in the claim, are typically provided in the claim to allow insurers to confirm the ordering of the insurance coverages relative to local 'coordination of benefit' rules. One coverage (and only one) with 'focal=true' is to be used in the adjudication of this claim. Coverages appearing before the focal Coverage in the list, and where 'subrogation=false', should provide a reference to the ClaimResponse containing the adjudication results of the prior claim. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<CoverageEligibilityRequestInsurance>>,
    /// 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>>,
    /** **Item to be evaluated for eligibiity**

 Service categories or billable services for which benefit details and/or an authorization prior to service delivery may be required by the payor.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<CoverageEligibilityRequestItem>>,
    /// 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 CoverageEligibilityRequestBuilder {
    #[doc = concat!("Finalize building ", "CoverageEligibilityRequest", ".")]
    pub fn build(
        self,
    ) -> Result<CoverageEligibilityRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CoverageEligibilityRequestInner> for CoverageEligibilityRequest {
    fn from(inner: CoverageEligibilityRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CoverageEligibilityRequest {
    type Target = CoverageEligibilityRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CoverageEligibilityRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CoverageEligibilityRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestBuilder {
        CoverageEligibilityRequestBuilder::default()
    }
}
impl CoverageEligibilityRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CoverageEligibilityRequest
    }
}
/// Sub-fields of the event field in CoverageEligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityRequestEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityRequestEvent {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A coded event such as when a service is expected or a card printed.

 */
    #[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>,
    /** **Occurance date or period**

 A date or period in the past or future indicating when the event occurred or is expectd to occur.

 */
    #[serde(flatten)]
    pub when: CoverageEligibilityRequestEventWhen,
    /// 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<CoverageEligibilityRequestEventWhenExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityRequestEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestEventBuilder {
        CoverageEligibilityRequestEventBuilder::default()
    }
}
/// Choice of types for the when[x] field in CoverageEligibilityRequestEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestEventWhen {
    /// Variant accepting the DateTime type.
    #[serde(rename = "whenDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
}
/// Extension value for CoverageEligibilityRequestEventWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestEventWhenExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_whenDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the serviced[x] field in CoverageEligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for CoverageEligibilityRequestServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestServicedExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_servicedDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_servicedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the supportingInfo field in CoverageEligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityRequestSupportingInfoBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityRequestSupportingInfo {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 A number to uniquely identify supporting information entries.

 */
    #[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>,
    /** **Data to be provided**

 Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.

 Could be used to provide references to other resources, document. For example could contain a PDF in an Attachment of the Police Report for an Accident. */
    #[serde(rename = "information")]
    pub information: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_information")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub information_ext: Option<FieldExtension>,
    /** **Applies to all items**

 The supporting materials are applicable for all detail items, product/servce categories and specific billing codes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appliesToAll")]
    pub applies_to_all: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appliesToAll")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applies_to_all_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityRequestSupportingInfo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestSupportingInfoBuilder {
        CoverageEligibilityRequestSupportingInfoBuilder::default()
    }
}
/// Sub-fields of the insurance field in CoverageEligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityRequestInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityRequestInsurance {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A flag to indicate that this Coverage is to be used for evaluation of this request when set to true.

 A patient may (will) have multiple insurance policies which provide reimburement for healthcare services and products. For example a person may also be covered by their spouse's policy and both appear in the list (and may be from the same insurer). This flag will be set to true for only one of the listed policies and that policy will be used for evaluating this request. Other requests would be created to request evaluation against the other listed policies. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focal")]
    pub focal: Option<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 insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.

 */
    #[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>,
    /** **Additional provider contract number**

 A business agreement number established between the provider and the insurer for special business processing purposes.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityRequestInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestInsuranceBuilder {
        CoverageEligibilityRequestInsuranceBuilder::default()
    }
}
/// Sub-fields of the item field in CoverageEligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityRequestItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityRequestItem {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 Exceptions, special conditions and supporting information 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 = "supportingInfoSequence")]
    pub supporting_info_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInfoSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_info_sequence_ext: Vec<Option<FieldExtension>>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 This contains the product, service, drug or other billing code for the item.

 Code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS, USCLS, ICD10, NCPDP, DIN, RxNorm, ACHI, CCI). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Product or service billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in 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>>,
    /** **Perfoming practitioner**

 The practitioner who is responsible for the product or service to be 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>,
    /** **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 item**

 The amount charged to the patient by the provider for a single unit.

 */
    #[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>,
    /** **Servicing facility**

 Facility where the services will be 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>,
    /** **Applicable diagnosis**

 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<CoverageEligibilityRequestItemDiagnosis>>,
    /// 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>>,
    /** **Product or service details**

 The plan/proposal/order describing the proposed service in detail.

 */
    #[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 CoverageEligibilityRequestItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestItemBuilder {
        CoverageEligibilityRequestItemBuilder::default()
    }
}
/// Sub-fields of the diagnosis field in CoverageEligibilityRequestItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityRequestItemDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityRequestItemDiagnosis {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 The nature of illness or problem in a coded form or as a reference to an external defined Condition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub diagnosis: Option<CoverageEligibilityRequestItemDiagnosisDiagnosis>,
    /// 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<CoverageEligibilityRequestItemDiagnosisDiagnosisExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityRequestItemDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityRequestItemDiagnosisBuilder {
        CoverageEligibilityRequestItemDiagnosisBuilder::default()
    }
}
/// Choice of types for the diagnosis[x] field in CoverageEligibilityRequestItemDiagnosis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestItemDiagnosisDiagnosis {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "diagnosisCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "diagnosisReference")]
    Reference(Reference),
}
/// Extension value for CoverageEligibilityRequestItemDiagnosisDiagnosis.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityRequestItemDiagnosisDiagnosisExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_diagnosisCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_diagnosisReference")]
    Reference(FieldExtension),
}
/** This resource provides eligibility and plan details from the processing of an CoverageEligibilityRequest resource.

 **[CoverageEligibilityResponse](http://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponse) v5.0.0**

 CoverageEligibilityResponse resource

 This resource provides eligibility and plan details from the processing of an CoverageEligibilityRequest resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CoverageEligibilityResponse(pub Box<CoverageEligibilityResponseInner>);
/** This resource provides eligibility and plan details from the processing of an CoverageEligibilityRequest resource.

 **[CoverageEligibilityResponse](http://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponse) v5.0.0**

 CoverageEligibilityResponse resource

 This resource provides eligibility and plan details from the processing of an CoverageEligibilityRequest 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 = "CoverageEligibilityResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CoverageEligibilityResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CoverageEligibilityResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CoverageEligibilityResponse", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 coverage eligiblity request**

 A unique identifier assigned to this coverage eligiblity 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>>,
    /** **[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 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>,
    /** **[EligibilityResponsePurpose](http://hl7.org/fhir/ValueSet/eligibilityresponse-purpose); auth-requirements | benefits | discovery | validation**

 Code to specify whether requesting: prior authorization requirements for some service categories or billing codes; benefits for coverages specified or discovered; discovery and return of coverages for the patient; and/or validation that the specified coverage is in-force at the date/period specified or 'now' if not specified.

 */
    #[serde(rename = "purpose")]
    pub purpose: Vec<Option<codes::EligibilityResponsePurpose>>,
    /// 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>>,
    /** **Intended recipient of products and services**

 The party who is the beneficiary of the supplied coverage and for whom eligibility is sought.

 */
    #[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>,
    /** **Event information**

 Information code for an event with a corresponding date or period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<CoverageEligibilityResponseEvent>>,
    /// 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>>,
    /** **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<CoverageEligibilityResponseServiced>,
    /// 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<CoverageEligibilityResponseServicedExtension>,
    /** **Response creation date**

 The date this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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>,
    /** **Party responsible for the request**

 The provider which is responsible for the request.

 This party is responsible for the claim but not necessarily professionally responsible for the provision of the individual products and services listed below. This field is the Billing Provider, for example, a facility, provider group, lab or practitioner. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestor")]
    pub requestor: Option<Reference>,
    /// 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>,
    /** **Eligibility request reference**

 Reference to the original request resource.

 */
    #[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>,
    /** **[EligibilityOutcome](http://hl7.org/fhir/ValueSet/eligibility-outcome); queued | complete | error | partial**

 The outcome of the request processing.

 The resource may be used to indicate that: the request has been held (queued) for processing; that it has been processed and errors found (error); that no errors were found and that some of the adjudication has been undertaken (partial) or that all of the adjudication has been undertaken (complete). */
    #[serde(rename = "outcome")]
    pub outcome: codes::ClaimProcessingCodes,
    /// 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 human readable 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>,
    /** **Coverage issuer**

 The Insurer who issued the coverage in question and is the author of the response.

 */
    #[serde(rename = "insurer")]
    pub insurer: 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>,
    /** **Patient insurance information**

 Financial instruments for reimbursement for the health care products and services.

 All insurance coverages for the patient which may be applicable for reimbursement, of the products and services listed in the claim, are typically provided in the claim to allow insurers to confirm the ordering of the insurance coverages relative to local 'coordination of benefit' rules. One coverage (and only one) with 'focal=true' is to be used in the adjudication of this claim. Coverages appearing before the focal Coverage in the list, and where 'subrogation=false', should provide a reference to the ClaimResponse containing the adjudication results of the prior claim. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<CoverageEligibilityResponseInsurance>>,
    /// 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>>,
    /** **Preauthorization reference**

 A reference from the Insurer to which these services pertain to be used on further communication and as proof that the request occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_ref_ext: Option<FieldExtension>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed form identifier**

 A code for the form to be used for printing the content.

 May be needed to identify specific jurisdictional forms. */
    #[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**

 Errors encountered during the processing of the request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "error")]
    pub error: Vec<Option<CoverageEligibilityResponseError>>,
    /// 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 CoverageEligibilityResponseBuilder {
    #[doc = concat!("Finalize building ", "CoverageEligibilityResponse", ".")]
    pub fn build(
        self,
    ) -> Result<CoverageEligibilityResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CoverageEligibilityResponseInner> for CoverageEligibilityResponse {
    fn from(inner: CoverageEligibilityResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CoverageEligibilityResponse {
    type Target = CoverageEligibilityResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CoverageEligibilityResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CoverageEligibilityResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseBuilder {
        CoverageEligibilityResponseBuilder::default()
    }
}
impl CoverageEligibilityResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CoverageEligibilityResponse
    }
}
/// Sub-fields of the event field in CoverageEligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityResponseEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityResponseEvent {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

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

 A coded event such as when a service is expected or a card printed.

 */
    #[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>,
    /** **Occurance date or period**

 A date or period in the past or future indicating when the event occurred or is expectd to occur.

 */
    #[serde(flatten)]
    pub when: CoverageEligibilityResponseEventWhen,
    /// 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<CoverageEligibilityResponseEventWhenExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityResponseEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseEventBuilder {
        CoverageEligibilityResponseEventBuilder::default()
    }
}
/// Choice of types for the when[x] field in CoverageEligibilityResponseEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseEventWhen {
    /// Variant accepting the DateTime type.
    #[serde(rename = "whenDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
}
/// Extension value for CoverageEligibilityResponseEventWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseEventWhenExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_whenDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the serviced[x] field in CoverageEligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for CoverageEligibilityResponseServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseServicedExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_servicedDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_servicedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the insurance field in CoverageEligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityResponseInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityResponseInsurance {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.

 */
    #[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>,
    /** **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>,
    /** **When the benefits are applicable**

 The term of the benefits documented in this response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitPeriod")]
    pub benefit_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_benefitPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub benefit_period_ext: Option<FieldExtension>,
    /** **Benefits and authorization details**

 Benefits and optionally current balances, and authorization details by category or service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<CoverageEligibilityResponseInsuranceItem>>,
    /// 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 CoverageEligibilityResponseInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseInsuranceBuilder {
        CoverageEligibilityResponseInsuranceBuilder::default()
    }
}
/// Sub-fields of the item field in CoverageEligibilityResponseInsurance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityResponseInsuranceItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityResponseInsuranceItem {
    /** **Unique id for inter-element referencing**

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

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

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

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

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 This contains the product, service, drug or other billing code for the item.

 Code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS, USCLS, ICD10, NCPDP, DIN, RxNorm, ACHI, CCI). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Product or service billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example in 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>>,
    /** **Performing practitioner**

 The practitioner who is eligible for the provision of the product or service.

 */
    #[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>,
    /** **Excluded from the plan**

 True if the indicated class of service is excluded from the plan, missing or False indicates the product or 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 or services covered.

 For example 'DENT2 covers 100% of basic, 50% of major but excludes Ortho, Implants and Cosmetic 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**

 Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.

 */
    #[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**

 Indicates if the benefits apply to an individual or to the 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 visits'.

 */
    #[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 = "benefit")]
    pub benefit: Vec<Option<CoverageEligibilityResponseInsuranceItemBenefit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_benefit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub benefit_ext: Vec<Option<FieldExtension>>,
    /** **Authorization required flag**

 A boolean flag indicating whether a preauthorization is required prior to actual service delivery.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorizationRequired")]
    pub authorization_required: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authorizationRequired")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authorization_required_ext: Option<FieldExtension>,
    /** **[AuthSupporting](http://hl7.org/fhir/ValueSet/coverageeligibilityresponse-ex-auth-support); Type of required supporting materials**

 Codes or comments regarding information or actions associated with the preauthorization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorizationSupporting")]
    pub authorization_supporting: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authorizationSupporting")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authorization_supporting_ext: Vec<Option<FieldExtension>>,
    /** **Preauthorization requirements endpoint**

 A web location for obtaining requirements or descriptive information regarding the preauthorization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorizationUrl")]
    pub authorization_url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authorizationUrl")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authorization_url_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityResponseInsuranceItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseInsuranceItemBuilder {
        CoverageEligibilityResponseInsuranceItemBuilder::default()
    }
}
/// Sub-fields of the benefit field in CoverageEligibilityResponseInsuranceItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityResponseInsuranceItemBenefitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityResponseInsuranceItemBenefit {
    /** **Unique id for inter-element referencing**

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

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

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

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Benefit classification**

 Classification of benefit being provided.

 For example: deductible, 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**

 The quantity of the benefit which is permitted under the coverage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub allowed: Option<CoverageEligibilityResponseInsuranceItemBenefitAllowed>,
    /// 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<
        CoverageEligibilityResponseInsuranceItemBenefitAllowedExtension,
    >,
    /** **Benefits used**

 The quantity of the benefit which have been consumed to date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub used: Option<CoverageEligibilityResponseInsuranceItemBenefitUsed>,
    /// 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<CoverageEligibilityResponseInsuranceItemBenefitUsedExtension>,
}
#[cfg(feature = "builders")]
impl CoverageEligibilityResponseInsuranceItemBenefit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseInsuranceItemBenefitBuilder {
        CoverageEligibilityResponseInsuranceItemBenefitBuilder::default()
    }
}
/// Choice of types for the allowed[x] field in CoverageEligibilityResponseInsuranceItemBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseInsuranceItemBenefitAllowed {
    /// 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 CoverageEligibilityResponseInsuranceItemBenefitAllowed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseInsuranceItemBenefitAllowedExtension {
    /// 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 CoverageEligibilityResponseInsuranceItemBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseInsuranceItemBenefitUsed {
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "usedUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the String type.
    #[serde(rename = "usedString")]
    String(String),
    /// Variant accepting the Money type.
    #[serde(rename = "usedMoney")]
    Money(Money),
}
/// Extension value for CoverageEligibilityResponseInsuranceItemBenefitUsed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CoverageEligibilityResponseInsuranceItemBenefitUsedExtension {
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_usedUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_usedString")]
    String(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_usedMoney")]
    Money(FieldExtension),
}
/// Sub-fields of the error field in CoverageEligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageEligibilityResponseErrorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageEligibilityResponseError {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **FHIRPath of element(s) related to issue**

 A [simple subset of FHIRPath](fhirpath.html#simple) limited to element names, repetition indicators and the default child accessor 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 CoverageEligibilityResponseError {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageEligibilityResponseErrorBuilder {
        CoverageEligibilityResponseErrorBuilder::default()
    }
}
/** 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, gaps in care, etc.

 **[DetectedIssue](http://hl7.org/fhir/StructureDefinition/DetectedIssue) v5.0.0**

 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, gaps in care, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DetectedIssue(pub Box<DetectedIssueInner>);
/** 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, gaps in care, etc.

 **[DetectedIssue](http://hl7.org/fhir/StructureDefinition/DetectedIssue) v5.0.0**

 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, gaps in care, 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 = "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>>,
    /** **[DetectedIssueStatus](http://hl7.org/fhir/ValueSet/detectedissue-status); preliminary | final | entered-in-error | mitigated**

 Indicates the status of the detected issue.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the issue as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::DetectedIssueStatus,
    /// 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); Type of detected issue, e.g. drug-drug, duplicate therapy, etc**

 A code that classifies the general type of detected issue.

 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>>,
    /** **[DetectedIssueCategory](http://hl7.org/fhir/ValueSet/detectedissue-category); Specific type of detected issue, e.g. drug-drug, duplicate therapy, etc**

 Identifies the specific type of issue identified.

 */
    #[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>,
    /** **[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 subject**

 Indicates the subject 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 = "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 detected issue is part of**

 The encounter during which this issue was detected.

 This will typically be the encounter the DetectedIssue was created during, but some DetectedIssues may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (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 = "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 identified**

 The date or period 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(flatten)]
    pub identified: Option<DetectedIssueIdentified>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identified_ext: Option<DetectedIssueIdentifiedExtension>,
    /** **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>>,
    /** **Supporting evidence**

 Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evidence")]
    pub evidence: Vec<Option<DetectedIssueEvidence>>,
    /// 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>>,
    /** **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 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
    }
}
/// Choice of types for the identified[x] field in DetectedIssue
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DetectedIssueIdentified {
    /// Variant accepting the DateTime type.
    #[serde(rename = "identifiedDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "identifiedPeriod")]
    Period(Period),
}
/// Extension value for DetectedIssueIdentified.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DetectedIssueIdentifiedExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_identifiedDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_identifiedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the evidence 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 = "DetectedIssueEvidenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DetectedIssueEvidence {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DetectedIssueEvidenceCode](http://hl7.org/fhir/ValueSet/manifestation-or-symptom); Manifestation**

 A manifestation that led to the recording of this detected issue.

 */
    #[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**

 Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.

 */
    #[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 DetectedIssueEvidence {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DetectedIssueEvidenceBuilder {
        DetectedIssueEvidenceBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 might 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>,
    /** **Additional notes about the mitigation**

 Clinicians may add additional notes or justifications about the mitigation action. For example, patient can have this drug because they have had it before without any issues. Multiple justifications may be provided.

 */
    #[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 DetectedIssueMitigation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DetectedIssueMitigationBuilder {
        DetectedIssueMitigationBuilder::default()
    }
}
/** This resource describes the properties (regulated, has real time clock, etc.), adminstrative (manufacturer name, model number, serial number, firmware, etc.), and type (knee replacement, blood pressure cuff, MRI, etc.) of a physical unit (these values do not change much within a given module, for example the serail number, manufacturer name, and model number). An actual unit may consist of several modules in a distinct hierarchy and these are represented by multiple Device resources and bound through the 'parent' element.

 **[Device](http://hl7.org/fhir/StructureDefinition/Device) v5.0.0**

 Item used in healthcare

 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.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Device(pub Box<DeviceInner>);
/** This resource describes the properties (regulated, has real time clock, etc.), adminstrative (manufacturer name, model number, serial number, firmware, etc.), and type (knee replacement, blood pressure cuff, MRI, etc.) of a physical unit (these values do not change much within a given module, for example the serail number, manufacturer name, and model number). An actual unit may consist of several modules in a distinct hierarchy and these are represented by multiple Device resources and bound through the 'parent' element.

 **[Device](http://hl7.org/fhir/StructureDefinition/Device) v5.0.0**

 Item used in healthcare

 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.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 Certain attributes, like serial number and UDI Carrier (the HRF or AIDC barcode string) are not device instance identifiers as they are not consistently able to uniquely identify the instance of a device, thus are not appropriate to be used to value Device.identifier. 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. The identifier is typically valued if the serialNumber or lotNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type. */
    #[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>>,
    /** **The name used to display by default when the device is referenced**

 The name used to display by default when the device is referenced. Based on intent of use by the resource creator, this may reflect one of the names in Device.name, or may be another simple name.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "displayName")]
    pub display_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_displayName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_name_ext: Option<FieldExtension>,
    /** **The reference to the definition for the device**

 The reference to the definition for the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<CodeableReference>,
    /// 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>,
    /** **Unique Device Identifier (UDI) Barcode string**

 Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.

 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udiCarrier")]
    pub udi_carrier: Vec<Option<DeviceUdiCarrier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udiCarrier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_carrier_ext: Vec<Option<FieldExtension>>,
    /** **[FHIRDeviceStatus](http://hl7.org/fhir/ValueSet/device-status); active | inactive | entered-in-error**

 The Device record status. This is not the status of the device like availability.

 */
    #[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>,
    /** **[FHIRDeviceAvailabilityStatus](http://hl7.org/fhir/ValueSet/device-availability-status); lost | damaged | destroyed | available**

 The availability of the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availabilityStatus")]
    pub availability_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availabilityStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub availability_status_ext: Option<FieldExtension>,
    /** **An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled**

 An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.

 Necessary to support mandatory requirements for traceability from donor/source to recipient and vice versa, while also satisfying donor anonymity requirements. The element is defined consistently across BiologicallyDerivedProduct, NutritionProduct, and Device.  The identifier references an event that links to a single biological entity such as a blood donor, or to multiple biological entities (e.g. when the product is an embryo or a pooled platelet product).  A single biologicalSourceEvent identifier may appear on multiple products of many types derived from a single donation event or source extraction.  As an example, a single donation event may provide 2 kidneys and a liver for organ transplantation, 2 corneas for eye surgery, heart valves and arterial tissue for cardiovascular surgery, multiple skin grafts, tendons, multiple shaped bone grafts and a large number of bone putty/paste products; and each of them may be assigned to the same biological source event identifier. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "biologicalSourceEvent")]
    pub biological_source_event: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_biologicalSourceEvent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub biological_source_event_ext: Option<FieldExtension>,
    /** **Name of device manufacturer**

 A name of the manufacturer or entity legally responsible for the device.

 */
    #[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>,
    /** **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>,
    /** **Serial number assigned by the manufacturer**

 The serial number assigned by the organization when the device was manufactured.

 Alphanumeric Maximum 20. While a serial number is a type of identifier, in the context of devices for which a UDI is required, thus a serial number may be part of the production identifier, it is more informative to have the serial number as a dedicated attribute together with the other UDI production identifier.  When the device is not subject to including the UDI (e.g., its presence and exchange is not mandated by local regulatory requirements or specific use case at hand), thus the concept of production identifiers is not relevant as a set, it remains helpful for consistency to still use Device.serialNumber rather than using Device.identifier with an appropriate type.  Systems that do not realize an identifier is a serial number may place it in Device.identifier or if the identifier.system is known for the serial number, it may also be populated in the Device.identifier as a globally unique id_. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serialNumber")]
    pub serial_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_serialNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub serial_number_ext: Option<FieldExtension>,
    /** **The name or names of the device as known to the manufacturer and/or patient**

 This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<DeviceName>>,
    /// 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>>,
    /** **The manufacturer's model number for the device**

 The manufacturer's model number for the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modelNumber")]
    pub model_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modelNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub model_number_ext: Option<FieldExtension>,
    /** **The part number or catalog number of the device**

 The part number or catalog number of the device.

 Alphanumeric Maximum 20. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partNumber")]
    pub part_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_number_ext: Option<FieldExtension>,
    /** **[DeviceCategory](http://hl7.org/fhir/ValueSet/device-category); Indicates a high-level grouping of the device**

 Devices may be associated with one or more categories.

 */
    #[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>>,
    /** **[DeviceType](http://hl7.org/fhir/ValueSet/device-type); The kind or type of device**

 The kind or type of device. A device instance may have more than one type - in which case those are the types that apply to the specific instance of the device.

 Multiple device types are use when a device is categorized in more than one context – for example, hybrid devices in which the device is both of type gateway and sensor. */
    #[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 actual design of the device or software version running on the device**

 The actual design of the device or software version running on the device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Vec<Option<DeviceVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub version_ext: Vec<Option<FieldExtension>>,
    /** **Identifies the standards, specifications, or formal guidances for the capabilities supported by the device**

 Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conformsTo")]
    pub conforms_to: Vec<Option<DeviceConformsTo>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_conformsTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub conforms_to_ext: Vec<Option<FieldExtension>>,
    /** **Inherent, essentially fixed, characteristics of the device.  e.g., time properties, size, material, etc.**

 Static or essentially fixed characteristics or features of the device (e.g., time or timing attributes, resolution, accuracy, intended use or instructions for use, and physical attributes) that are not otherwise captured in more specific attributes.

 Dynamic or current properties, such as settings, of an individual device are described using a Device instance-specific [DeviceMetric] and recorded using [Observation].  Static characteristics of a device could also be documented in an associated [DeviceDefinition] instance. The Device instance's properties, and their values, could be, but need not be, the same as those described in an associated DeviceDefinition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<DeviceProperty>>,
    /// 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>>,
    /** **[DeviceOperationMode](http://hl7.org/fhir/ValueSet/device-operation-mode); The designated condition for performing a task**

 The designated condition for performing a task with the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mode")]
    pub mode: Option<CodeableConcept>,
    /// 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>,
    /** **The series of occurrences that repeats during the operation of the device**

 The series of occurrences that repeats during the operation of the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cycle")]
    pub cycle: Option<Count>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cycle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cycle_ext: Option<FieldExtension>,
    /** **A measurement of time during the device's operation (e.g., days, hours, mins, etc.)**

 A measurement of time during the device's operation (e.g., days, hours, mins, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "duration")]
    pub duration: Option<Duration>,
    /// 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>,
    /** **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 device 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>,
    /** **Technical endpoints providing access to electronic services provided by the device**

 Technical endpoints providing access to services provided by the device 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>>,
    /** **Linked device acting as a communication/data collector, translator or controller**

 The linked device acting as a communication controller, data collector, translator, or concentrator for the current device (e.g., mobile phone application that relays a blood pressure device's data).

 The Device.gateway may be used when the Device being referenced has a gateway and/or to capture one or more gateways associated with the device. If the Gateway is included in the Observation resource, the Observation.gatewayDevice should be used instead. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gateway")]
    pub gateway: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_gateway")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub gateway_ext: Vec<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>>,
    /** **[Safety](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>>,
    /** **The higher level or encompassing device that this device is a logical part of**

 The higher level or encompassing device that this device is a logical part of.

 For example a vital signs monitor (parent) where three separate modules can be plugged into such as interchangeable blood pressure, oximeter, temperature modules.  These modules are represented as devices with the .parent valued to the vital signs monitor when plugged in. */
    #[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>,
}
#[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 udiCarrier 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 = "DeviceUdiCarrierBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceUdiCarrier {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(rename = "deviceIdentifier")]
    pub device_identifier: 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>,
    /** **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-diI,
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 # Informationsstelle für Arzneispezialitäten (IFA GmbH) (EU only): http://hl7.org/fhir/NamingSystem/ifa-gmbh-di.

 */
    #[serde(rename = "issuer")]
    pub issuer: 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>,
    /** **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/us-fda-udi or in the European Union by the European Commission http://hl7.org/fhir/NamingSystem/eu-ec-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 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 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>,
    /** **[UDIEntryType](http://hl7.org/fhir/ValueSet/udi-entry-type); barcode | rfid | manual | card | self-reported | electronic-transmission | unknown**

 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 DeviceUdiCarrier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceUdiCarrierBuilder {
        DeviceUdiCarrierBuilder::default()
    }
}
/// Sub-fields of the name 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 = "DeviceNameBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceName {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 term that names the device**

 The actual name that identifies the device.

 */
    #[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>,
    /** **[DeviceNameType](http://hl7.org/fhir/ValueSet/device-nametype); registered-name | user-friendly-name | patient-reported-name**

 Indicates the kind of name. RegisteredName | UserFriendlyName | PatientReportedName.

 */
    #[serde(rename = "type")]
    pub r#type: codes::DeviceNameType,
    /// 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 preferred device name**

 Indicates the default or preferred name to be displayed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<bool>,
    /// 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 DeviceName {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceNameBuilder {
        DeviceNameBuilder::default()
    }
}
/// Sub-fields of the version 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 = "DeviceVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceVersion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FHIRDeviceVersionType](http://hl7.org/fhir/ValueSet/device-versiontype); The type of the device version, e.g. manufacturer, approved, internal**

 The type of the device version, e.g. manufacturer, approved, internal.

 */
    #[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 hardware or software module of the device to which the version applies**

 The hardware or software module of the device to which the version applies.

 Note that the module of the device would not need to be tracked as a separate device, e.g., using different UDI, thus would typically involve one or more software modules. For example, a device may involve two software modules each on a different version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_component")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub component_ext: Option<FieldExtension>,
    /** **The date the version was installed on the device**

 The date the version was installed on the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "installDate")]
    pub install_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_installDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub install_date_ext: Option<FieldExtension>,
    /** **The version text**

 The version text.

 */
    #[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 DeviceVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceVersionBuilder {
        DeviceVersionBuilder::default()
    }
}
/// Sub-fields of the conformsTo 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 = "DeviceConformsToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceConformsTo {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceSpecificationCategory](http://hl7.org/fhir/ValueSet/device-specification-category); Describes the common type of the standard, specification, or formal guidance.  communication | performance | measurement**

 Describes the type of the standard, specification, or formal guidance.

 */
    #[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>,
    /** **[DeviceSpecification-type](http://hl7.org/fhir/ValueSet/device-specification-type); Identifies the standard, specification, or formal guidance that the device adheres to**

 Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.

 */
    #[serde(rename = "specification")]
    pub specification: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specification_ext: Option<FieldExtension>,
    /** **Specific form or variant of the standard**

 Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.

 */
    #[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 DeviceConformsTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceConformsToBuilder {
        DeviceConformsToBuilder::default()
    }
}
/// Sub-fields of the property 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 = "DevicePropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DevicePropertyType](http://hl7.org/fhir/ValueSet/device-property-type); Code that specifies the property being represented**

 Code that specifies the property, such as resolution, color, size, being represented.

 */
    #[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>,
    /** **Value of the property**

 The value of the property specified by the associated property.type code.

 The text element in CodeableConcept.text is used for properties which would usually be coded (such as the size of an implant, or a security classification) but for which there is not currently an appropriate concept in the vocabulary (e.g. a custom implant size, or a security classification which depends on configuration). Otherwise the string choice type is used for descriptive properties, or instructions. */
    #[serde(flatten)]
    pub value: DevicePropertyValue,
    /// 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<DevicePropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl DeviceProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DevicePropertyBuilder {
        DevicePropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in DeviceProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DevicePropertyValue {
    /// 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 Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for DevicePropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DevicePropertyValueExtension {
    /// 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 Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/** A record of association of a device.

 **[DeviceAssociation](http://hl7.org/fhir/StructureDefinition/DeviceAssociation) v5.0.0**

 A record of association or dissociation of a device with a patient

 A record of association or dissociation of a device with a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceAssociation(pub Box<DeviceAssociationInner>);
/** A record of association of a device.

 **[DeviceAssociation](http://hl7.org/fhir/StructureDefinition/DeviceAssociation) v5.0.0**

 A record of association or dissociation of a device with a patient

 A record of association or dissociation of a device with 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 = "DeviceAssociationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceAssociationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceAssociation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceAssociation", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Instance 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>>,
    /** **Reference to the devices associated with the patient or group**

 Reference to the devices associated with the patient or group.

 */
    #[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>,
    /** **Describes the relationship between the device and subject**

 Describes the relationship between the device and subject.

 */
    #[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>>,
    /** **[DeviceAssociationStatus](http://hl7.org/fhir/ValueSet/deviceassociation-status); implanted | explanted | attached | entered-in-error | unknown**

 Indicates the state of the Device association.

 */
    #[serde(rename = "status")]
    pub status: CodeableConcept,
    /// 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>,
    /** **[DeviceAssociationStatusReason](http://hl7.org/fhir/ValueSet/deviceassociation-status-reason); The reasons given for the current association status**

 The reasons given for the current association status.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_reason_ext: Vec<Option<FieldExtension>>,
    /** **The individual, group of individuals or device that the device is on or associated with**

 The individual, group of individuals or device that the device is on or associated with.

 */
    #[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>,
    /** **Current anatomical location of the device in/on subject**

 Current anatomical location of the device in/on subject.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodyStructure")]
    pub body_structure: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodyStructure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_structure_ext: Option<FieldExtension>,
    /** **Begin and end dates and times for the device association**

 Begin and end dates and times for the device association.

 */
    #[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 details about the device when it is in use to describe its operation**

 The details about the device when it is in use to describe its operation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Vec<Option<DeviceAssociationOperation>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl DeviceAssociationBuilder {
    #[doc = concat!("Finalize building ", "DeviceAssociation", ".")]
    pub fn build(self) -> Result<DeviceAssociation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceAssociationInner> for DeviceAssociation {
    fn from(inner: DeviceAssociationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceAssociation {
    type Target = DeviceAssociationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceAssociation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceAssociation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceAssociationBuilder {
        DeviceAssociationBuilder::default()
    }
}
impl DeviceAssociation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceAssociation
    }
}
/// Sub-fields of the operation field in DeviceAssociation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceAssociationOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceAssociationOperation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceAssociationOperationStatus](http://hl7.org/fhir/ValueSet/deviceassociation-operationstatus); Device operational condition**

 Device operational condition corresponding to the association.

 */
    #[serde(rename = "status")]
    pub status: CodeableConcept,
    /// 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 individual performing the action enabled by the device**

 The individual performing the action enabled by the device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operator")]
    pub operator: Vec<Option<Reference>>,
    /// 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>>,
    /** **Begin and end dates and times for the device's operation**

 Begin and end dates and times for the device's operation.

 */
    #[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 DeviceAssociationOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceAssociationOperationBuilder {
        DeviceAssociationOperationBuilder::default()
    }
}
/** This is a specialized resource that defines the characteristics and capabilities of a device.

 **[DeviceDefinition](http://hl7.org/fhir/StructureDefinition/DeviceDefinition) v5.0.0**

 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 DeviceDefinition 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 DeviceDefinition(pub Box<DeviceDefinitionInner>);
/** This is a specialized resource that defines the characteristics and capabilities of a device.

 **[DeviceDefinition](http://hl7.org/fhir/StructureDefinition/DeviceDefinition) v5.0.0**

 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 DeviceDefinition 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 = "DeviceDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 information to describe the device**

 Additional information to describe the device.

 */
    #[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>,
    /** **Instance identifier**

 Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.

 */
    #[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) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udiDeviceIdentifier")]
    pub udi_device_identifier: Vec<Option<DeviceDefinitionUdiDeviceIdentifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udiDeviceIdentifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_device_identifier_ext: Vec<Option<FieldExtension>>,
    /** **Regulatory identifier(s) associated with this device**

 Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.

 This should not be used for regulatory authorization numbers which are to be captured elsewhere. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regulatoryIdentifier")]
    pub regulatory_identifier: Vec<Option<DeviceDefinitionRegulatoryIdentifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_regulatoryIdentifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub regulatory_identifier_ext: Vec<Option<FieldExtension>>,
    /** **The part number or catalog number of the device**

 The part number or catalog number of the device.

 Alphanumeric Maximum 20. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partNumber")]
    pub part_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_number_ext: Option<FieldExtension>,
    /** **Name of device manufacturer**

 A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.

 */
    #[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>,
    /** **The name or names of the device as given by the manufacturer**

 The name or names of the device as given by the manufacturer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deviceName")]
    pub device_name: Vec<Option<DeviceDefinitionDeviceName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_deviceName")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub device_name_ext: Vec<Option<FieldExtension>>,
    /** **The catalog or model number for the device for example as defined by the manufacturer**

 The model number for the device for example as defined by the manufacturer or labeler, or other agency.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modelNumber")]
    pub model_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modelNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub model_number_ext: Option<FieldExtension>,
    /** **What kind of device or device system this is**

 What kind of device or device system this is.

 In this element various classifications can be used, such as GMDN, EMDN, SNOMED CT, risk classes, national product codes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<DeviceDefinitionClassification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
    /** **Identifies the standards, specifications, or formal guidances for the capabilities supported by the device**

 Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conformsTo")]
    pub conforms_to: Vec<Option<DeviceDefinitionConformsTo>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_conformsTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub conforms_to_ext: Vec<Option<FieldExtension>>,
    /** **A device, part of the current one**

 A device that is part (for example a component) of the present device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasPart")]
    pub has_part: Vec<Option<DeviceDefinitionHasPart>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_hasPart")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub has_part_ext: Vec<Option<FieldExtension>>,
    /** **Information about the packaging of the device, i.e. how the device is packaged**

 Information about the packaging of the device, i.e. how the device is packaged.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packaging")]
    pub packaging: Vec<Option<DeviceDefinitionPackaging>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packaging")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub packaging_ext: Vec<Option<FieldExtension>>,
    /** **The version of the device or software**

 The version of the device or software.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Vec<Option<DeviceDefinitionVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub version_ext: Vec<Option<FieldExtension>>,
    /** **[Safety](http://hl7.org/fhir/ValueSet/device-safety); Safety characteristics of the device**

 Safety characteristics of the device.

 */
    #[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>>,
    /** **Shelf Life and storage information**

 Shelf Life and storage information.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "shelfLifeStorage")]
    pub shelf_life_storage: Vec<Option<ProductShelfLife>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_shelfLifeStorage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub shelf_life_storage_ext: Vec<Option<FieldExtension>>,
    /** **Language code for the human-readable text strings produced by the device (all supported)**

 Language code for the human-readable text strings produced by the device (all supported).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "languageCode")]
    pub language_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_languageCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub language_code_ext: Vec<Option<FieldExtension>>,
    /** **Inherent, essentially fixed, characteristics of this kind of device, e.g., time properties, size, etc**

 Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes.

 Dynamic or current properties, such as settings, of an individual device are described using a Device instance-specific DeviceMetric and recorded using Observation.  Static characteristics of an individual device could also be documented in a [Device] instance. The Device instance's properties, and their values, could be, but need not be, the same as in the associated DeviceDefinition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<DeviceDefinitionProperty>>,
    /// 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>>,
    /** **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>>,
    /** **An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device**

 An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<DeviceDefinitionLink>>,
    /// 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>>,
    /** **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>>,
    /** **A substance used to create the material(s) of which the device is made**

 A substance used to create the material(s) of which the device is made.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "material")]
    pub material: Vec<Option<DeviceDefinitionMaterial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_material")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub material_ext: Vec<Option<FieldExtension>>,
    /** **[DeviceProductionIdentifierInUDI](http://hl7.org/fhir/ValueSet/device-productidentifierinudi); lot-number | manufactured-date | serial-number | expiration-date | biological-source | software-version**

 Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productionIdentifierInUDI")]
    pub production_identifier_in_udi: Vec<
        Option<codes::DeviceProductionIdentifierInUDI>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_productionIdentifierInUDI")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub production_identifier_in_udi_ext: Vec<Option<FieldExtension>>,
    /** **Information aimed at providing directions for the usage of this model of device**

 Information aimed at providing directions for the usage of this model of device.

 For more structured data, a ClinicalUseDefinition that points to the DeviceDefinition can be used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "guideline")]
    pub guideline: Option<DeviceDefinitionGuideline>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_guideline")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub guideline_ext: Option<FieldExtension>,
    /** **Tracking of latest field safety corrective action**

 Tracking of latest field safety corrective action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "correctiveAction")]
    pub corrective_action: Option<DeviceDefinitionCorrectiveAction>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_correctiveAction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub corrective_action_ext: Option<FieldExtension>,
    /** **Billing code or reference associated with the device**

 Billing code or reference associated with the device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "chargeItem")]
    pub charge_item: Vec<Option<DeviceDefinitionChargeItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_chargeItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub charge_item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionBuilder {
    #[doc = concat!("Finalize building ", "DeviceDefinition", ".")]
    pub fn build(self) -> Result<DeviceDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceDefinitionInner> for DeviceDefinition {
    fn from(inner: DeviceDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceDefinition {
    type Target = DeviceDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceDefinitionBuilder {
        DeviceDefinitionBuilder::default()
    }
}
impl DeviceDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceDefinition
    }
}
/// Sub-fields of the udiDeviceIdentifier field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionUdiDeviceIdentifierBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionUdiDeviceIdentifier {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier**

 The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.

 */
    #[serde(rename = "deviceIdentifier")]
    pub device_identifier: 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>,
    /** **The organization that assigns the identifier algorithm**

 The organization that assigns the identifier algorithm.

 */
    #[serde(rename = "issuer")]
    pub issuer: 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>,
    /** **The jurisdiction to which the deviceIdentifier applies**

 The jurisdiction to which the deviceIdentifier applies.

 */
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: 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>,
    /** **Indicates whether and when the device is available on the market**

 Indicates where and when the device is available on the market.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "marketDistribution")]
    pub market_distribution: Vec<
        Option<DeviceDefinitionUdiDeviceIdentifierMarketDistribution>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_marketDistribution")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub market_distribution_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionUdiDeviceIdentifier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionUdiDeviceIdentifierBuilder {
        DeviceDefinitionUdiDeviceIdentifierBuilder::default()
    }
}
/// Sub-fields of the marketDistribution field in DeviceDefinitionUdiDeviceIdentifier
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionUdiDeviceIdentifierMarketDistributionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionUdiDeviceIdentifierMarketDistribution {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Begin and end dates for the commercial distribution of the device**

 Begin and end dates for the commercial distribution of the device.

 */
    #[serde(rename = "marketPeriod")]
    pub market_period: Period,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_marketPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub market_period_ext: Option<FieldExtension>,
    /** **National state or territory where the device is commercialized**

 National state or territory to which the marketDistribution recers, typically where the device is commercialized.

 */
    #[serde(rename = "subJurisdiction")]
    pub sub_jurisdiction: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subJurisdiction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_jurisdiction_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionUdiDeviceIdentifierMarketDistribution {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionUdiDeviceIdentifierMarketDistributionBuilder {
        DeviceDefinitionUdiDeviceIdentifierMarketDistributionBuilder::default()
    }
}
/// Sub-fields of the regulatoryIdentifier field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionRegulatoryIdentifierBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionRegulatoryIdentifier {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceRegulatoryIdentifierType](http://hl7.org/fhir/ValueSet/devicedefinition-regulatory-identifier-type); basic | master | license**

 The type of identifier itself.

 */
    #[serde(rename = "type")]
    pub r#type: codes::DeviceRegulatoryIdentifierType,
    /// 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 identifier itself**

 The identifier itself.

 */
    #[serde(rename = "deviceIdentifier")]
    pub device_identifier: 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>,
    /** **The organization that issued this identifier**

 The organization that issued this identifier.

 */
    #[serde(rename = "issuer")]
    pub issuer: 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>,
    /** **The jurisdiction to which the deviceIdentifier applies**

 The jurisdiction to which the deviceIdentifier applies.

 */
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: 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>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionRegulatoryIdentifier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionRegulatoryIdentifierBuilder {
        DeviceDefinitionRegulatoryIdentifierBuilder::default()
    }
}
/// Sub-fields of the deviceName field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionDeviceNameBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionDeviceName {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 that is used to refer to the device**

 A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.

 */
    #[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>,
    /** **[DeviceNameType](http://hl7.org/fhir/ValueSet/device-nametype); registered-name | user-friendly-name | patient-reported-name**

 The type of deviceName.
RegisteredName | UserFriendlyName | PatientReportedName.

 */
    #[serde(rename = "type")]
    pub r#type: codes::DeviceNameType,
    /// 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 DeviceDefinitionDeviceName {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionDeviceNameBuilder {
        DeviceDefinitionDeviceNameBuilder::default()
    }
}
/// Sub-fields of the classification field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionClassificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionClassification {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceKind](http://hl7.org/fhir/ValueSet/device-type); A classification or risk class of the device model**

 A classification or risk class of the device model.

 */
    #[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>,
    /** **Further information qualifying this classification of the device model**

 Further information qualifying this classification of the device model.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "justification")]
    pub justification: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_justification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub justification_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionClassification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionClassificationBuilder {
        DeviceDefinitionClassificationBuilder::default()
    }
}
/// Sub-fields of the conformsTo field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionConformsToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionConformsTo {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceSpecificationCategory](http://hl7.org/fhir/ValueSet/device-specification-category); Describes the common type of the standard, specification, or formal guidance**

 Describes the type of the standard, specification, or formal guidance.

 */
    #[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>,
    /** **[DeviceSpecificationType](http://hl7.org/fhir/ValueSet/device-specification-type); Identifies the standard, specification, or formal guidance that the device adheres to the Device Specification type**

 Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.

 */
    #[serde(rename = "specification")]
    pub specification: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specification_ext: Option<FieldExtension>,
    /** **The specific form or variant of the standard, specification or formal guidance**

 Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub version_ext: Vec<Option<FieldExtension>>,
    /** **Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance**

 Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<RelatedArtifact>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionConformsTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionConformsToBuilder {
        DeviceDefinitionConformsToBuilder::default()
    }
}
/// Sub-fields of the hasPart field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionHasPartBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionHasPart {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 part**

 Reference to the device that is part of the current device.

 */
    #[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>,
    /** **Number of occurrences of the part**

 Number of instances of the component device in the current device.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionHasPart {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionHasPartBuilder {
        DeviceDefinitionHasPartBuilder::default()
    }
}
/// Sub-fields of the packaging field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionPackagingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionPackaging {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the packaged medication**

 The business identifier of the packaged medication.

 */
    #[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 code that defines the specific type of packaging**

 A code that defines the specific type of packaging.

 */
    #[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 number of items contained in the package (devices or sub-packages)**

 The number of items contained in the package (devices or sub-packages).

 */
    #[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>,
    /** **An organization that distributes the packaged device**

 An organization that distributes the packaged device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "distributor")]
    pub distributor: Vec<Option<DeviceDefinitionPackagingDistributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_distributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub distributor_ext: Vec<Option<FieldExtension>>,
    /** **Unique Device Identifier (UDI) Barcode string on the packaging**

 Unique Device Identifier (UDI) Barcode string on the packaging.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udiDeviceIdentifier")]
    pub udi_device_identifier: Vec<Option<DeviceDefinitionUdiDeviceIdentifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udiDeviceIdentifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_device_identifier_ext: Vec<Option<FieldExtension>>,
    /** **Allows packages within packages**

 Allows packages within packages.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packaging")]
    pub packaging: Vec<Option<DeviceDefinitionPackaging>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packaging")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub packaging_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionPackaging {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionPackagingBuilder {
        DeviceDefinitionPackagingBuilder::default()
    }
}
/// Sub-fields of the distributor field in DeviceDefinitionPackaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionPackagingDistributorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionPackagingDistributor {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Distributor's human-readable name**

 Distributor's human-readable 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>,
    /** **Distributor as an Organization resource**

 Distributor as an Organization resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organizationReference")]
    pub organization_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_organizationReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub organization_reference_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionPackagingDistributor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionPackagingDistributorBuilder {
        DeviceDefinitionPackagingDistributorBuilder::default()
    }
}
/// Sub-fields of the version field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionVersion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of the device version, e.g. manufacturer, approved, internal**

 The type of the device version, e.g. manufacturer, approved, internal.

 */
    #[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 hardware or software module of the device to which the version applies**

 The hardware or software module of the device to which the version applies.

 Note that the module of the device would not need to be tracked as a separate device, e.g., using different UDI, thus would typically involve one or more software modules. For example, a device may involve two software modules each on a different version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_component")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub component_ext: Option<FieldExtension>,
    /** **The version text**

 The version text.

 */
    #[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 DeviceDefinitionVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionVersionBuilder {
        DeviceDefinitionVersionBuilder::default()
    }
}
/// Sub-fields of the property field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DevicePropertyType](http://hl7.org/fhir/ValueSet/device-property-type); Code that specifies the property being represented**

 Code that specifies the property such as a resolution or color being represented.

 */
    #[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>,
    /** **Value of the property**

 The value of the property specified by the associated property.type code.

 This use of string or CodeableConcept is supported to address different purposes The text element of the valueCodeableConcept choice type is used for properties which would usually be coded (such as the size of an implant, or a security classification) but for which there is not currently an appropriate concept in the vocabulary (e.g., a custom implant size, or a security classification which depends on configuration. Otherwise the valueString choice type is used for textual descriptive device properties that cannot be expressed in other elements. */
    #[serde(flatten)]
    pub value: DeviceDefinitionPropertyValue,
    /// 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<DeviceDefinitionPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionPropertyBuilder {
        DeviceDefinitionPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in DeviceDefinitionProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceDefinitionPropertyValue {
    /// 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 Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for DeviceDefinitionPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceDefinitionPropertyValueExtension {
    /// 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 Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/// Sub-fields of the link field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionLink {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceDefinitionRelationType](http://hl7.org/fhir/ValueSet/devicedefinition-relationtype); The type indicates the relationship of the related device to the device instance**

 The type indicates the relationship of the related device to the device instance.

 */
    #[serde(rename = "relation")]
    pub relation: Coding,
    /// 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>,
    /** **A reference to the linked device**

 A reference to the linked device.

 */
    #[serde(rename = "relatedDevice")]
    pub related_device: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedDevice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_device_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionLinkBuilder {
        DeviceDefinitionLinkBuilder::default()
    }
}
/// Sub-fields of the material field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionMaterialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionMaterial {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 relevant substance that the device contains, may contain, or is made of**

 A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.

 */
    #[serde(rename = "substance")]
    pub substance: 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>,
    /** **Indicates an alternative material of the device**

 Indicates an alternative material of the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alternate")]
    pub alternate: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_alternate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub alternate_ext: Option<FieldExtension>,
    /** **Whether the substance is a known or suspected allergen**

 Whether the substance is a known or suspected allergen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allergenicIndicator")]
    pub allergenic_indicator: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_allergenicIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub allergenic_indicator_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionMaterial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionMaterialBuilder {
        DeviceDefinitionMaterialBuilder::default()
    }
}
/// Sub-fields of the guideline field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionGuidelineBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionGuideline {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 circumstances that form the setting for using the device**

 The circumstances that form the setting for using the device.

 */
    #[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>>,
    /** **Detailed written and visual directions for the user on how to use the device**

 Detailed written and visual directions for the user on how to use the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usageInstruction")]
    pub usage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_instruction_ext: Option<FieldExtension>,
    /** **A source of information or reference for this guideline**

 A source of information or reference for this guideline.

 */
    #[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>>,
    /** **A clinical condition for which the device was designed to be used**

 A clinical condition for which the device was designed to be used.

 A ClinicalUseDefinition that points to the DeviceDefinition can be used if more structured data is needed. */
    #[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>>,
    /** **A specific situation when a device should not be used because it may cause harm**

 A specific situation when a device should not be used because it may cause harm.

 A ClinicalUseDefinition that points to the DeviceDefinition can be used if more structured data is needed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contraindication")]
    pub contraindication: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contraindication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contraindication_ext: Vec<Option<FieldExtension>>,
    /** **Specific hazard alert information that a user needs to know before using the device**

 Specific hazard alert information that a user needs to know before using the device.

 A ClinicalUseDefinition that points to the DeviceDefinition can be used if more structured data is needed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "warning")]
    pub warning: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_warning")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub warning_ext: Vec<Option<FieldExtension>>,
    /** **A description of the general purpose or medical use of the device or its function**

 A description of the general purpose or medical use of the device or its function.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedUse")]
    pub intended_use: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intendedUse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intended_use_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionGuideline {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionGuidelineBuilder {
        DeviceDefinitionGuidelineBuilder::default()
    }
}
/// Sub-fields of the correctiveAction field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionCorrectiveActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionCorrectiveAction {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the corrective action was a recall**

 Whether the last corrective action known for this device was a recall.

 When a field safety action has been initiated but not yet resulted in a recall, this element will be set to 'false'. */
    #[serde(rename = "recall")]
    pub recall: bool,
    /// 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>,
    /** **[DeviceCorrectiveActionScope](http://hl7.org/fhir/ValueSet/device-correctiveactionscope); model | lot-numbers | serial-numbers**

 The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Option<codes::DeviceCorrectiveActionScope>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scope_ext: Option<FieldExtension>,
    /** **Start and end dates of the  corrective action**

 Start and end dates of the  corrective action.

 */
    #[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 DeviceDefinitionCorrectiveAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionCorrectiveActionBuilder {
        DeviceDefinitionCorrectiveActionBuilder::default()
    }
}
/// Sub-fields of the chargeItem field in DeviceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDefinitionChargeItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDefinitionChargeItem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 code or reference for the charge item**

 The code or reference for the charge item.

 */
    #[serde(rename = "chargeItemCode")]
    pub charge_item_code: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_chargeItemCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub charge_item_code_ext: Option<FieldExtension>,
    /** **Coefficient applicable to the billing code**

 Coefficient applicable to the billing code.

 */
    #[serde(rename = "count")]
    pub count: Quantity,
    /// 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>,
    /** **A specific time period in which this charge item applies**

 A specific time period in which this charge item applies.

 */
    #[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>,
    /** **The context to which this charge item applies**

 The context to which this charge item applies.

 */
    #[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>>,
}
#[cfg(feature = "builders")]
impl DeviceDefinitionChargeItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDefinitionChargeItemBuilder {
        DeviceDefinitionChargeItemBuilder::default()
    }
}
/** Indicates that a device is to be or has been dispensed for a named person/patient.  This includes a description of the product (supply) provided and the instructions for using the device.

 **[DeviceDispense](http://hl7.org/fhir/StructureDefinition/DeviceDispense) v5.0.0**

 A record of dispensation of a device

 A record of dispensation of a device - i.e., assigning a device to a patient, or to a professional for their use.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceDispense(pub Box<DeviceDispenseInner>);
/** Indicates that a device is to be or has been dispensed for a named person/patient.  This includes a description of the product (supply) provided and the instructions for using the device.

 **[DeviceDispense](http://hl7.org/fhir/StructureDefinition/DeviceDispense) v5.0.0**

 A record of dispensation of a device

 A record of dispensation of a device - i.e., assigning a device to a patient, or to a professional for their use.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDispenseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceDispenseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceDispense::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceDispense", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this dispensation**

 Business identifier for this dispensation.

 This is a business identifier, not a resource 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>>,
    /** **The order or request that this dispense is fulfilling**

 The order or request that this dispense is fulfilling.

 */
    #[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>>,
    /** **The bigger event that this dispense is a part of**

 The bigger event that this dispense is a part 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>>,
    /** **[DeviceDispenseStatus](http://hl7.org/fhir/ValueSet/devicedispense-status); preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown**

 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(rename = "status")]
    pub status: codes::DeviceDispenseStatusCodes,
    /// 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>,
    /** **[DeviceDispenseStatusReason](http://hl7.org/fhir/ValueSet/devicedispense-status-reason); Why a dispense was or was not performed**

 Indicates the reason why a dispense was or was not performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Option<CodeableReference>,
    /// 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>,
    /** **Type of device dispense**

 Indicates the type of device dispense.

 The category can be used to include where the device is expected to be consumed or other types of dispenses.  Invariants can be used to bind to different value sets when profiling to bind. */
    #[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>>,
    /** **What device was supplied**

 Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices.

 */
    #[serde(rename = "device")]
    pub device: CodeableReference,
    /// 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 the dispense is for**

 A link to a resource representing the person to whom the device is intended.

 What about 'this measuring Device is now asigned to Dr X who needs it now'? */
    #[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>,
    /** **Who collected the device or where the medication was delivered**

 Identifies the person who picked up the device or the person or location where the device was delivered.  This may be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.

 */
    #[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>,
    /** **Encounter associated with event**

 The encounter 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 = "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>,
    /** **Information that supports the dispensing of the device**

 Additional information that supports the device 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.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<DeviceDispensePerformer>>,
    /// 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 dispense occurred**

 The principal physical location where the dispense was performed.

 */
    #[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>,
    /** **Trial fill, partial fill, emergency fill, etc**

 Indicates the type of dispensing event that is performed.

 */
    #[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 number of devices that have been dispensed.

 */
    #[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>,
    /** **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 = "preparedDate")]
    pub prepared_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preparedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prepared_date_ext: Option<FieldExtension>,
    /** **When product was given out**

 The time the dispensed product was made available 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 device was sent or should be sent**

 Identification of the facility/location where the device was /should be shipped to, as part of the dispense process.

 */
    #[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>,
    /** **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>>,
    /** **Full representation of the usage instructions**

 The full representation of the instructions.

 The content of the renderedDosageInstructions must not be different than the dose represented in the dosageInstruction content. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usageInstruction")]
    pub usage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_instruction_ext: Option<FieldExtension>,
    /** **A list of relevant lifecycle events**

 A summary of the events of interest that have occurred, such as when the dispense was verified.

 This might 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 DeviceDispenseBuilder {
    #[doc = concat!("Finalize building ", "DeviceDispense", ".")]
    pub fn build(self) -> Result<DeviceDispense, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceDispenseInner> for DeviceDispense {
    fn from(inner: DeviceDispenseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceDispense {
    type Target = DeviceDispenseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceDispense {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceDispense {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceDispenseBuilder {
        DeviceDispenseBuilder::default()
    }
}
impl DeviceDispense {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceDispense
    }
}
/// Sub-fields of the performer field in DeviceDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceDispensePerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceDispensePerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 performed the dispense and what they did**

 Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Individual who was performing**

 The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the device.

 */
    #[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 DeviceDispensePerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceDispensePerformerBuilder {
        DeviceDispensePerformerBuilder::default()
    }
}
/** Describes a measurement, calculation or setting capability of a device.  The DeviceMetric resource is derived from the ISO/IEEE 11073-10201 Domain Information Model standard, but is more widely applicable.

 **[DeviceMetric](http://hl7.org/fhir/StructureDefinition/DeviceMetric) v5.0.0**

 Measurement, calculation or setting capability of a medical device

 Describes a measurement, calculation or setting capability of a device.

 The DeviceMetric resource is derived from the ISO/IEEE 11073-10201 Domain Information Model standard, but is more widely applicable. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceMetric(pub Box<DeviceMetricInner>);
/** Describes a measurement, calculation or setting capability of a device.  The DeviceMetric resource is derived from the ISO/IEEE 11073-10201 Domain Information Model standard, but is more widely applicable.

 **[DeviceMetric](http://hl7.org/fhir/StructureDefinition/DeviceMetric) v5.0.0**

 Measurement, calculation or setting capability of a medical device

 Describes a measurement, calculation or setting capability of a device.

 The DeviceMetric resource is derived from the ISO/IEEE 11073-10201 Domain Information Model standard, but is more widely applicable. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Instance identifiers assigned to a device, by the device or gateway software, manufacturers, other organizations or owners. For example, handle ID.

 For identifiers assigned to a device by the device or gateway software, the `system` element of the identifier should be set to any identifier of the 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>>,
    /** **[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/ucum-units); 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 Device**

 Describes the link to the Device.  This is also known as a channel device.

 Note if this is not the top level device - also know as the source device, it may be referenced in the device.parent element. */
    #[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>,
    /** **[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>,
    /** **[](http://hl7.org/fhir/ValueSet/color-codes); Color name (from CSS4) or #RRGGBB code**

 The preferred color associated with the metric (e.g., display color). 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; the metrics are displayed in different characteristic colors, such as HR in blue, BP in green, and PR and SpO2 in magenta.

 */
    #[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>,
    /** **[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>,
    /** **Indicates how often the metric is taken or recorded**

 The frequency at which the metric is taken or recorded. Devices measure metrics at a wide range of frequencies; for example, an ECG might sample measurements in the millisecond range, while an NIBP might trigger only once an hour. Less often, the measurementFrequency may be based on a unit other than time, such as distance (e.g. for a measuring wheel). The update period may be different than the measurement frequency, 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 = "measurementFrequency")]
    pub measurement_frequency: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementFrequency")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_frequency_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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** Represents a request a device to be provided to a specific patient. The device may be an implantable device to be subsequently implanted, or an external assistive device, such as a walker, to be delivered and subsequently be used.

 **[DeviceRequest](http://hl7.org/fhir/StructureDefinition/DeviceRequest) v5.0.0**

 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>);
/** Represents a request a device to be provided to a specific patient. The device may be an implantable device to be subsequently implanted, or an external assistive device, such as a walker, to be delivered and subsequently be used.

 **[DeviceRequest](http://hl7.org/fhir/StructureDefinition/DeviceRequest) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance number. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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>>,
    /** **Identifier of composite request**

 A shared identifier common to multiple independent Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 */
    #[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 | on-hold | revoked | completed | entered-in-error | unknown**

 The status of the request.

 This element is labeled as a modifier because the status contains the codes revoked 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 | directive | order | original-order | reflex-order | filler-order | instance-order | option**

 Whether the request is a proposal, plan, an original order or a reflex 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>,
    /** **[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>,
    /** **True if the request is to stop or not to start using the device**

 If true, indicates that the provider is asking for the patient to either stop using or to not start using the specified device or category of devices. For example, the patient has undergone surgery and the provider is indicating that the patient should not wear contact lenses.

 If do not perform is not specified, the request is a positive request e.g. "do perform". DeviceRequest.reasonCode includes the reason for marking the DeviceRequest as 'do not perform'. */
    #[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>,
    /** **[DeviceRequestCode](http://hl7.org/fhir/ValueSet/device-type); Device requested**

 The details of the device to be used.

 */
    #[serde(rename = "code")]
    pub code: CodeableReference,
    /// 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>,
    /** **Quantity of devices to supply**

 The number of devices to be provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<i32>,
    /// 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>,
    /** **Device details**

 Specific parameters for the ordered item.  For example, the prism value for lenses.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<DeviceRequestParameter>>,
    /// 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>>,
    /** **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 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 = "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>,
    /** **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 submitted the device request**

 The individual or entity 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<Reference>,
    /// 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>,
    /** **Requested Filler**

 The desired individual or entity to provide the device to the subject of the request (e.g., patient, location).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<CodeableReference>,
    /// 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/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 = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **PRN status of request**

 This status is to indicate whether the request is a PRN or may be given as needed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeeded")]
    pub as_needed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeeded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_ext: Option<FieldExtension>,
    /** **Device usage reason**

 The reason for using the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeededFor")]
    pub as_needed_for: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeededFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_for_ext: Option<FieldExtension>,
    /** **Associated insurance coverage**

 Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<Reference>>,
    /// 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>>,
    /** **Additional clinical information**

 Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body 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 might 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
    }
}
/// Sub-fields of the parameter 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 = "DeviceRequestParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceRequestParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ParameterCode](); Device detail**

 A code or string that identifies the device detail being asserted.

 */
    #[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>,
    /** **Value of detail**

 The value of the device detail.

 Range means device should have a value that falls somewhere within the specified range. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<DeviceRequestParameterValue>,
    /// 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<DeviceRequestParameterValueExtension>,
}
#[cfg(feature = "builders")]
impl DeviceRequestParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceRequestParameterBuilder {
        DeviceRequestParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in DeviceRequestParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestParameterValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
}
/// Extension value for DeviceRequestParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestParameterValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(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),
}
/** A record of a device being used by a patient where the record is the result of a report from the patient or a clinician.

 **[DeviceUsage](http://hl7.org/fhir/StructureDefinition/DeviceUsage) v5.0.0**

 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 a clinician.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceUsage(pub Box<DeviceUsageInner>);
/** A record of a device being used by a patient where the record is the result of a report from the patient or a clinician.

 **[DeviceUsage](http://hl7.org/fhir/StructureDefinition/DeviceUsage) v5.0.0**

 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 a 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 = "DeviceUsageBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceUsageInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceUsage::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceUsage", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Fulfills plan, proposal or order**

 A plan, proposal or order that is fulfilled in whole or in part by this DeviceUsage.

 */
    #[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>>,
    /** **[DeviceUsageStatus](http://hl7.org/fhir/ValueSet/deviceusage-status); active | completed | not-done | 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::DeviceUsageStatus,
    /// 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 category of the statement - classifying how the statement is made**

 This attribute indicates a category for the statement - The device statement may be made in an inpatient or outpatient settting (inpatient | outpatient | community | patientspecified).

 */
    #[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>>,
    /** **Patient using device**

 The patient who used the device.

 */
    #[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>,
    /** **Supporting information**

 Allows linking the DeviceUsage to the underlying Request, or to other information that supports or is used to derive the DeviceUsage.

 The most common use cases for deriving a DeviceUsage comes from creating it from a request or from an 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 DeviceUsage 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>>,
    /** **The encounter or episode of care that establishes the context for this device use statement**

 The encounter or episode of care that establishes the context for this device use statement.

 */
    #[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>,
    /** **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<DeviceUsageTiming>,
    /// 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<DeviceUsageTimingExtension>,
    /** **When the statement was made (and recorded)**

 The time at which the statement was recorded by informationSource.

 */
    #[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>,
    /** **[DeviceUsageStatus](http://hl7.org/fhir/ValueSet/deviceusage-status); The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement**

 The status of the device usage, for example always, sometimes, never. This is not the same as the status of the statement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usageStatus")]
    pub usage_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usageStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_status_ext: Option<FieldExtension>,
    /** **The reason for asserting the usage status - for example forgot, lost, stolen, broken**

 The reason for asserting the usage status - for example forgot, lost, stolen, broken.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usageReason")]
    pub usage_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_usageReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub usage_reason_ext: Vec<Option<FieldExtension>>,
    /** **How device is being used**

 This indicates how or if the device is being used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adherence")]
    pub adherence: Option<DeviceUsageAdherence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adherence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adherence_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 = "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>,
    /** **Code or Reference to device used**

 Code or Reference to device used.

 */
    #[serde(rename = "device")]
    pub device: CodeableReference,
    /// 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. A coded concept, or another resource whose existence justifies this DeviceUsage.

 When the status is not done, the reason code indicates why it was not done. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Target body site**

 Indicates the anotomic location on the subject's body where the device was used ( i.e. the target).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableReference>,
    /// 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 DeviceUsageBuilder {
    #[doc = concat!("Finalize building ", "DeviceUsage", ".")]
    pub fn build(self) -> Result<DeviceUsage, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceUsageInner> for DeviceUsage {
    fn from(inner: DeviceUsageInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceUsage {
    type Target = DeviceUsageInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceUsage {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceUsage {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceUsageBuilder {
        DeviceUsageBuilder::default()
    }
}
impl DeviceUsage {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceUsage
    }
}
/// Choice of types for the timing[x] field in DeviceUsage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceUsageTiming {
    /// 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 DeviceUsageTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceUsageTimingExtension {
    /// 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),
}
/// Sub-fields of the adherence field in DeviceUsage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceUsageAdherenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceUsageAdherence {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceUsageAdherenceCode](http://hl7.org/fhir/ValueSet/deviceusage-adherence-code); always | never | sometimes**

 Type of adherence.

 */
    #[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>,
    /** **[DeviceUsageAdherenceReason](http://hl7.org/fhir/ValueSet/deviceusage-adherence-reason); lost | stolen | prescribed | broken | burned | forgot**

 Reason for adherence type.

 */
    #[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>>,
}
#[cfg(feature = "builders")]
impl DeviceUsageAdherence {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceUsageAdherenceBuilder {
        DeviceUsageAdherenceBuilder::default()
    }
}
/** The findings and interpretation of diagnostic tests performed on patients, groups of patients, products, substances, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports. The report also includes non-clinical context such as batch analysis and stability reporting of products and substances.

 **[DiagnosticReport](http://hl7.org/fhir/StructureDefinition/DiagnosticReport) v5.0.0**

 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, products, substances, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports. The report also includes non-clinical context such as batch analysis and stability reporting of products and substances.

 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>);
/** The findings and interpretation of diagnostic tests performed on patients, groups of patients, products, substances, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports. The report also includes non-clinical context such as batch analysis and stability reporting of products and substances.

 **[DiagnosticReport](http://hl7.org/fhir/StructureDefinition/DiagnosticReport) v5.0.0**

 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, products, substances, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports. The report also includes non-clinical context such as batch analysis and stability reporting of products and substances.

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 service 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 | modified | final | amended | corrected | appended | cancelled | entered-in-error | unknown**

 The status of the diagnostic report.

 */
    #[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.

 Multiple categories are allowed using various categorization schemes.   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 = "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>>,
    /** **[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 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  but still be tied to the context of the encounter  (e.g. pre-admission laboratory tests). */
    #[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>,
    /** **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 made**

 The date and time that this version of the report was made available to providers, typically after the report was reviewed and verified.

 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>,
    /** **Responsible Diagnostic Service**

 The diagnostic service that is responsible for issuing the report.

 This is not necessarily the source of the atomic data items or the entity that interpreted the results. It is the entity that takes responsibility for the clinical 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<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>>,
    /** **Primary result interpreter**

 The practitioner or organization that is responsible for the report's conclusions and interpretations.

 Might not be the same entity that takes responsibility for the clinical report. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resultsInterpreter")]
    pub results_interpreter: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resultsInterpreter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub results_interpreter_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**

 [Observations](observation.html)  that are part of this diagnostic report.

 Observations can contain observations. */
    #[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>>,
    /** **Comments about the diagnostic report**

 Comments about the diagnostic report.

 May include general statements about the diagnostic report, or statements about significant, unexpected or unreliable results values contained within the diagnostic report, or information about its source when relevant to its interpretation. */
    #[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>>,
    /** **Reference to full details of an analysis associated with the diagnostic report**

 One or more links to full details of any study performed during the diagnostic investigation. An ImagingStudy might comprise a set of radiologic images obtained via a procedure that are analyzed as a group. 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. A GenomicStudy might comprise one or more analyses, each serving a specific purpose. These analyses may vary in method (e.g., karyotyping, CNV, or SNV detection), performer, software, devices used, or regions targeted.

 For laboratory-type studies like GenomeStudy, type resources will be used for tracking additional metadata and workflow aspects of complex studies. ImagingStudy and the media element are somewhat overlapping - typically, the list of image references in the media 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 = "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>>,
    /** **Additional information supporting the diagnostic report**

 This backbone element contains supporting information that was used in the creation of the report not included in the results already included in the report.

 */
    #[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<DiagnosticReportSupportingInfo>>,
    /// 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>>,
    /** **Key images or data associated with this report**

 A list of key images or data associated with this report. The images or data 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 = "media")]
    pub media: Vec<Option<DiagnosticReportMedia>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_media")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub media_ext: Vec<Option<FieldExtension>>,
    /** **Reference to a Composition resource for the DiagnosticReport structure**

 Reference to a Composition resource instance that provides structure for organizing the contents of the DiagnosticReport.

 The Composition provides structure to the content of the DiagnosticReport (and only contains contents referenced in the DiagnosticReport) - e.g., to order the sections of an anatomic pathology structured report. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "composition")]
    pub composition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_composition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub composition_ext: Option<FieldExtension>,
    /** **Clinical conclusion (interpretation) of test results**

 Concise and clinically contextualized summary conclusion (interpretation/impression) 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 clinical conclusion of test results**

 One or more codes that represent the summary conclusion (interpretation/impression) of the diagnostic report.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conclusionCode")]
    pub conclusion_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_conclusionCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub conclusion_code_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 supportingInfo 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 = "DiagnosticReportSupportingInfoBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DiagnosticReportSupportingInfo {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DiagnosticReportSupportingInfoType](http://terminology.hl7.org/ValueSet/v2-0936); Supporting information role code**

 The code value for the role of the supporting information in the diagnostic report.

 */
    #[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>,
    /** **Supporting information reference**

 The reference for the supporting information in the diagnostic report.

 */
    #[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 DiagnosticReportSupportingInfo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DiagnosticReportSupportingInfoBuilder {
        DiagnosticReportSupportingInfoBuilder::default()
    }
}
/// Sub-fields of the media 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 = "DiagnosticReportMediaBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DiagnosticReportMedia {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or data (e.g. explanation)**

 A comment about the image or data. Typically, this is used to provide an explanation for why the image or data is included, or to draw the viewer's attention to important features.

 The comment should be displayed with the image or data. It would be common for the report to include additional discussion of the image or data contents or 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 or data source**

 Reference to the image or data 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 DiagnosticReportMedia {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DiagnosticReportMediaBuilder {
        DiagnosticReportMediaBuilder::default()
    }
}
/** A reference to a document of any kind for any purpose. While the term “document” implies a more narrow focus, for this resource this “document” encompasses *any* serialized object with a mime-type, it includes formal patient-centric documents (CDA), clinical notes, scanned paper, non-patient specific documents like policy text, as well as a photo, video, or audio recording acquired or used in healthcare.  The DocumentReference resource provides metadata about the document so that the document can be discovered and managed.  The actual content may be inline base64 encoded data or provided by direct reference.

 **[DocumentReference](http://hl7.org/fhir/StructureDefinition/DocumentReference) v5.0.0**

 A reference to a document

 A reference to a document of any kind for any purpose. While the term “document” implies a more narrow focus, for this resource this "document" encompasses *any* serialized object with a mime-type, it includes formal patient-centric documents (CDA), clinical notes, scanned paper, non-patient specific documents like policy text, as well as a photo, video, or audio recording acquired or used in healthcare.  The DocumentReference resource provides metadata about the document so that the document can be discovered and managed.  The actual content may be inline base64 encoded data or provided by direct reference.

 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>);
/** A reference to a document of any kind for any purpose. While the term “document” implies a more narrow focus, for this resource this “document” encompasses *any* serialized object with a mime-type, it includes formal patient-centric documents (CDA), clinical notes, scanned paper, non-patient specific documents like policy text, as well as a photo, video, or audio recording acquired or used in healthcare.  The DocumentReference resource provides metadata about the document so that the document can be discovered and managed.  The actual content may be inline base64 encoded data or provided by direct reference.

 **[DocumentReference](http://hl7.org/fhir/StructureDefinition/DocumentReference) v5.0.0**

 A reference to a document

 A reference to a document of any kind for any purpose. While the term “document” implies a more narrow focus, for this resource this "document" encompasses *any* serialized object with a mime-type, it includes formal patient-centric documents (CDA), clinical notes, scanned paper, non-patient specific documents like policy text, as well as a photo, video, or audio recording acquired or used in healthcare.  The DocumentReference resource provides metadata about the document so that the document can be discovered and managed.  The actual content may be inline base64 encoded data or provided by direct reference.

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for the document**

 Other business identifiers associated with the document, including version independent identifiers.

 The structure and format of this identifier would be consistent with the specification corresponding to the format of the document. (e.g. for a DICOM standard document, a 64-character numeric UID; for an HL7 CDA format, the CDA Document Id root and extension). */
    #[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>>,
    /** **An explicitly assigned identifer of a variation of the content in the DocumentReference**

 An explicitly assigned identifer of a variation of the content in the DocumentReference.

 While each resource, including the DocumentReference itself, has its own version identifier, this is a formal identifier for the logical version of the DocumentReference as a whole. It would remain constant if the resources were moved to a new server, and all got new individual resource versions, for example. */
    #[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>,
    /** **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>>,
    /** **[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); registered | partial | preliminary | final | amended | corrected | appended | cancelled | entered-in-error | deprecated | unknown**

 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>,
    /** **[ImagingModality](http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_33.html); Imaging modality used**

 Imaging modality used. This may include both acquisition and non-acquisition modalities.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modality")]
    pub modality: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modality")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modality_ext: Vec<Option<FieldExtension>>,
    /** **[DocumentType](http://hl7.org/fhir/ValueSet/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 that describes he exact type of document. Helps humans to assess whether the document is of interest when viewing a list of documents. */
    #[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>,
    /** **[ReferencedItemCategory](http://hl7.org/fhir/ValueSet/referenced-item-category); 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.

 Key metadata element describing the the category or classification of the document. This is a broader perspective that groups similar documents based on how they would be used. This is a primary key used in searching. */
    #[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/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>,
    /** **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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Vec<Option<Reference>>,
    /// 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>>,
    /** **[DocumentEventType](http://terminology.hl7.org/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 type Code, 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<CodeableReference>>,
    /// 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>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Body part included**

 The anatomic structures included in the document.

 */
    #[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<CodeableReference>>,
    /// 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>>,
    /** **[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.

 This element should be based on a coarse classification system for the class of specialty practice. Recommend the use of the classification system for Practice Setting, such as that described by the Subject Matter Domain in LOINC. */
    #[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>,
    /** **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>,
    /** **When this document reference was created**

 When the document reference was created.

 Referencing/indexing time is used for tracking, organizing versions and searching. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<Instant>,
    /// 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 document**

 Identifies who is responsible for adding the information to the document.

 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>>,
    /** **Attests to accuracy of the document**

 A participant who has authenticated the accuracy of the 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<DocumentReferenceAttester>>,
    /// 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 document**

 Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.

 Identifies the logical organization (software system, vendor, or department) to go to find the current version, where to report issues, etc. This is different from the physical location (URL, disk drive, or server) 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**

 Human-readable description of the source document.

 What the document is about,  a terse summary of the document. */
    #[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-label-examples); Document security-tags**

 A set of Security-Tag codes specifying the level of privacy/security of the Document found at DocumentReference.content.attachment.url. Note that DocumentReference.meta.security contains the security labels of the data elements in DocumentReference, while DocumentReference.securityLabel contains the security labels for the document the reference refers to. The distinction recognizes that the document may contain sensitive information, while the DocumentReference is metadata about the document and thus might not be as sensitive as the document. For example: a psychotherapy episode may contain highly sensitive information, while the metadata may simply indicate that some episode happened.

 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.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.

 content element shall not contain different versions of the same content. For version handling use multiple DocumentReference with .relatesTo. */
    #[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>>,
}
#[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 attester 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 = "DocumentReferenceAttesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceAttester {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DocumentAttestationMode](http://hl7.org/fhir/ValueSet/composition-attestation-mode); personal | professional | legal | official**

 The type of attestation the authenticator offers.

 */
    #[serde(rename = "mode")]
    pub mode: CodeableConcept,
    /// 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>,
    /** **When the document was attested**

 When the document 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 document**

 Who attested the document 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 DocumentReferenceAttester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceAttesterBuilder {
        DocumentReferenceAttesterBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); The relationship type with another document**

 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: 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>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Content profile rules for the document**

 An identifier of the document constraints, encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.

 Note that IHE often issues URNs for formatCode codes, not all documents can be identified by a URI.

For FHIR content, .profile should indicate the structureDefinition profile canonical URI(s) that the content complies with. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Vec<Option<DocumentReferenceContentProfile>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceContent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceContentBuilder {
        DocumentReferenceContentBuilder::default()
    }
}
/// Sub-fields of the profile field in DocumentReferenceContent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceContentProfileBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceContentProfile {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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|uri|canonical**

 Code|uri|canonical.

 */
    #[serde(flatten)]
    pub value: DocumentReferenceContentProfileValue,
    /// 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<DocumentReferenceContentProfileValueExtension>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceContentProfile {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceContentProfileBuilder {
        DocumentReferenceContentProfileBuilder::default()
    }
}
/// Choice of types for the value[x] field in DocumentReferenceContentProfile
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DocumentReferenceContentProfileValue {
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
}
/// Extension value for DocumentReferenceContentProfileValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DocumentReferenceContentProfileValueExtension {
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(FieldExtension),
}
/** An interaction between healthcare provider(s), and/or patient(s) for the purpose of providing healthcare service(s) or assessing the health status of patient(s).

 **[Encounter](http://hl7.org/fhir/StructureDefinition/Encounter) v5.0.0**

 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.  Encounter is primarily used to record information about the actual activities that occurred, where Appointment is used to record planned activities.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Encounter(pub Box<EncounterInner>);
/** An interaction between healthcare provider(s), and/or patient(s) for the purpose of providing healthcare service(s) or assessing the health status of patient(s).

 **[Encounter](http://hl7.org/fhir/StructureDefinition/Encounter) v5.0.0**

 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.  Encounter is primarily used to record information about the actual activities that occurred, where Appointment is used to record planned activities.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown**

 The current state of the encounter (not the state of the patient within the encounter - that is subjectState).

 Note that internal business rules will determine the appropriate transitions that may occur between statuses (and also classes). */
    #[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>,
    /** **[EncounterClass](http://terminology.hl7.org/ValueSet/encounter-class); Classification of patient encounter context - e.g. Inpatient, outpatient**

 Concepts representing classification of patient encounter such as ambulatory (outpatient), inpatient, emergency, home health or others due to local variations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[Priority](http://terminology.hl7.org/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>,
    /** **[EncounterType](http://hl7.org/fhir/ValueSet/encounter-type); Specific type of encounter (e.g. e-mail consultation, surgical day-care, ...)**

 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>>,
    /** **[EncounterServiceType](http://hl7.org/fhir/ValueSet/service-type); Specific type of service**

 Broad categorization of the service that is to be provided (e.g. cardiology).

 */
    #[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<CodeableReference>>,
    /// 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>>,
    /** **The patient or group related to this encounter**

 The patient or group related to this encounter. In some use-cases the patient MAY not be present, such as a case meeting about a patient between several practitioners or a careteam.

 While the encounter is always about the patient, the patient might 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>,
    /** **[SubjectStatus](http://hl7.org/fhir/ValueSet/encounter-subject-status); The current status of the subject in relation to the Encounter**

 The subjectStatus value can be used to track the patient's status within the encounter. It details whether the patient has arrived or departed, has been triaged or is currently in a waiting status.

 Different use-cases are likely to have different permitted transitions between states, such as an Emergency department could use `arrived` when the patient first presents, then `triaged` once has been assessed by a nurse, then `receiving-care` once treatment begins, however other sectors may use a different set of these values, or their own custom set in place of this example valueset provided. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectStatus")]
    pub subject_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjectStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_status_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 request that initiated this encounter**

 The request this encounter satisfies (e.g. incoming referral or procedure 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>>,
    /** **The group(s) that are allocated to participate in this encounter**

 The group(s) of individuals, organizations that are allocated to participate in this encounter. The participants backbone will record the actuals of when these individuals participated during the encounter.

 */
    #[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>>,
    /** **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>,
    /** **The organization (facility) responsible for this encounter**

 The organization that is primarily responsible for this Encounter's services. This MAY be the same as the organization on the Patient record, however it could be different, such as if the actor performing the services was from an external organization (which may be billed seperately) for an external consultation.  Refer to the colonoscopy example on the Encounter examples tab.

 */
    #[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>,
    /** **List of participants involved in the encounter**

 The list of people responsible for providing the service.

 Any Patient or Group present in the participation.actor must also be the subject, though the subject may be absent from the participation.actor for cases where the patient (or group) is not present, such as during a case review conference. */
    #[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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointment")]
    pub appointment: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_appointment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub appointment_ext: Vec<Option<FieldExtension>>,
    /** **Connection details of a virtual service (e.g. conference call)**

 Connection details of a virtual service (e.g. conference call).

 There are two types of virtual meetings that often exist:

* a persistent, virtual meeting room that can only be used for a single purpose at a time,
* and a dynamic virtual meeting room that is generated on demand for a specific purpose.

Implementers may consider using Location.virtualService for persistent meeting rooms.

If each participant would have a different meeting link, an extension using the VirtualServiceContactDetail  can be applied to the Encounter.participant BackboneElement. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "virtualService")]
    pub virtual_service: Vec<Option<VirtualServiceDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_virtualService")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub virtual_service_ext: Vec<Option<FieldExtension>>,
    /** **The actual start and end time of the encounter**

 The actual 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 = "actualPeriod")]
    pub actual_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_period_ext: Option<FieldExtension>,
    /** **The planned start date/time (or admission date) of the encounter**

 The planned start date/time (or admission date) of the encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plannedStartDate")]
    pub planned_start_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plannedStartDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planned_start_date_ext: Option<FieldExtension>,
    /** **The planned end date/time (or discharge date) of the encounter**

 The planned end date/time (or discharge date) of the encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plannedEndDate")]
    pub planned_end_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plannedEndDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planned_end_date_ext: Option<FieldExtension>,
    /** **Actual quantity of time the encounter lasted (less time absent)**

 Actual quantity of time the encounter lasted. This excludes the time during leaves of absence.

When missing it is the time in between the start and end values.

 If the precision on these values is low (e.g. to the day only) then this may be considered was an all day (or multi-day) encounter, unless the duration is included, where that amount of time occurred sometime during the interval.

May differ from the time in `Encounter.period` due to leave of absence(s). */
    #[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>,
    /** **The list of medical reasons that are expected to be addressed during the episode of care**

 The list of medical reasons that are expected to be addressed during the episode of care.

 The reason communicates what medical problem the patient has that should be addressed during the episode of care.  This reason could be patient reported complaint, a clinical indication that was determined in a previous encounter or episode of care, or some planned care such as an immunization recommendation.  In the case where you have a primary reason, but are expecting to also address other problems, you can list the primary reason with a use code of 'Chief Complaint', while the other problems being addressed would have a use code of 'Reason for Visit'.

Examples:
 * pregnancy would use HealthcareService or a coding as the reason
 * patient home monitoring could use Condition as the reason */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<EncounterReason>>,
    /// 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.

 Also note that for the purpose of billing, the diagnoses are recorded in the account where they can be ranked appropriately for how the invoicing/claiming documentation needs to be prepared. */
    #[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>>,
    /** **[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>>,
    /** **[Arrangements](http://hl7.org/fhir/ValueSet/encounter-special-arrangements); Wheelchair, translator, stretcher, etc**

 Any special requests that have been made for this 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>>,
    /** **[Courtesies](http://hl7.org/fhir/ValueSet/encounter-special-courtesy); Special courtesies (VIP, board member)**

 Special courtesies that may be provided to the patient during the encounter (VIP, board member, professional courtesy).

 Although the specialCourtesy property can contain values like VIP, the purpose of this field is intended to be used for flagging additional `benefits` that might occur for the patient during the encounter.

It could include things like the patient is to have a private room, special room features, receive a friendly visit from hospital adminisitration, or should be briefed on treatment by senior staff during the stay.

It is not specifically intended to be used for securing the specific record - that is the purpose of the security meta tag, and where appropriate, both fields could be used. */
    #[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>>,
    /** **Details about the admission to a healthcare service**

 Details about the stay during which a healthcare service is provided.

This does not describe the event of admitting the patient, but rather any information that is relevant from the time of admittance until the time of discharge.

 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 admission record. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "admission")]
    pub admission: Option<EncounterAdmission>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_admission")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub admission_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>>,
}
#[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 actor participates 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>,
    /** **The individual, device, or service participating in the encounter**

 Person involved in the encounter, the patient/group is also included here to indicate that the patient was actually participating in the encounter. Not including the patient here covers use cases such as a case meeting between practitioners about a patient - non contact times.

 For planning purposes, Appointments may include a CareTeam participant to indicate that one specific person from the CareTeam will be assigned, but that assignment might not happen until the Encounter begins. Hence CareTeam is not included in Encounter.participant, as the specific individual should be assigned and represented as a Practitioner or other person resource.

Similarly, Location can be included in Appointment.participant to assist with planning.  However, the patient location is tracked on the Encounter in the Encounter.location property to allow for additional metadata and history to be recorded.

The role of the participant can be used to declare what the actor will be doing in the scope of this encounter participation.

If the individual is not specified during planning, then it is expected that the individual will be filled in at a later stage prior to the encounter commencing. */
    #[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>,
}
#[cfg(feature = "builders")]
impl EncounterParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterParticipantBuilder {
        EncounterParticipantBuilder::default()
    }
}
/// Sub-fields of the reason 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 = "EncounterReasonBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterReason {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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-use](http://hl7.org/fhir/ValueSet/encounter-reason-use); What the reason value should be used for/as**

 What the reason value should be used as e.g. Chief Complaint, Health Concern, Health Maintenance (including screening).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#use_ext: Vec<Option<FieldExtension>>,
    /** **[EncounterReason](http://hl7.org/fhir/ValueSet/encounter-reason); Reason the encounter takes place (core or reference)**

 Reason the encounter takes place, expressed as a code or a reference to another resource. For admissions, this can be used for a coded admission diagnosis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EncounterReason {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterReasonBuilder {
        EncounterReasonBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[condition-code](http://hl7.org/fhir/ValueSet/condition-code); The diagnosis relevant to the encounter**

 The coded diagnosis or a reference to a Condition (with other resources referenced in the evidence.detail), the use property will indicate the purpose of this specific diagnosis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[DiagnosisUse](http://hl7.org/fhir/ValueSet/encounter-diagnosis-use); 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#use_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EncounterDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterDiagnosisBuilder {
        EncounterDiagnosisBuilder::default()
    }
}
/// Sub-fields of the admission 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 = "EncounterAdmissionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterAdmission {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/organization from which the patient came before admission**

 The location/organization 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://terminology.hl7.org/ValueSet/v2-0092); Indicates that the patient is being re-admitted**

 Indicates that this encounter is directly related to a prior admission, often because the conditions addressed in the prior admission were not fully addressed.

 */
    #[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>,
    /** **Location/organization to which the patient is discharged**

 Location/organization 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 EncounterAdmission {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterAdmissionBuilder {
        EncounterAdmissionBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **[LocationForm](http://hl7.org/fhir/ValueSet/location-form); The physical type of the location (usually the level in the location hierarchy - bed, room, ward, virtual etc.)**

 This will be used to specify the required levels (bed/ward/room/etc.) desired to be recorded to simplify either messaging or query.

 This information is de-normalized from the Location resource to support the easier understanding of the encounter resource and processing in messaging or query.

There may be many levels in the hierachy, and this may only pic specific levels that are required for a specific usage scenario. */
    #[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>,
    /** **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()
    }
}
/** A record of significant events/milestones key data throughout the history of an Encounter

 **[EncounterHistory](http://hl7.org/fhir/StructureDefinition/EncounterHistory) v5.0.0**

 A record of significant events/milestones key data throughout the history of an Encounter

 A record of significant events/milestones key data throughout the history of an Encounter, often tracked for specific purposes such as billing.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EncounterHistory(pub Box<EncounterHistoryInner>);
/** A record of significant events/milestones key data throughout the history of an Encounter

 **[EncounterHistory](http://hl7.org/fhir/StructureDefinition/EncounterHistory) v5.0.0**

 A record of significant events/milestones key data throughout the history of an Encounter

 A record of significant events/milestones key data throughout the history of an Encounter, often tracked for specific purposes such as billing.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterHistoryBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EncounterHistoryInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EncounterHistory::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EncounterHistory", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Encounter associated with this set of historic values**

 The Encounter associated with this set of historic values.

 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 = "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>,
    /** **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 | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown**

 planned | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown.

 Note that internal business rules will determine the appropriate transitions that may occur between statuses (and also classes). */
    #[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>,
    /** **[EncounterClass](http://terminology.hl7.org/ValueSet/v3-ActEncounterCode); Classification of patient encounter**

 Concepts representing classification of patient encounter such as ambulatory (outpatient), inpatient, emergency, home health or others due to local variations.

 */
    #[serde(rename = "class")]
    pub class: 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>,
    /** **[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>>,
    /** **[EncounterServiceType](http://hl7.org/fhir/ValueSet/service-type); Specific type of service**

 Broad categorization of the service that is to be provided (e.g. cardiology).

 */
    #[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<CodeableReference>>,
    /// 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>>,
    /** **The patient or group related to this encounter**

 The patient or group related to this encounter. In some use-cases the patient MAY not be present, such as a case meeting about a patient between several practitioners or a careteam.

 While the encounter is always about the patient, the patient might 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>,
    /** **[SubjectStatus](http://hl7.org/fhir/ValueSet/encounter-subject-status); The current status of the subject in relation to the Encounter**

 The subjectStatus value can be used to track the patient's status within the encounter. It details whether the patient has arrived or departed, has been triaged or is currently in a waiting status.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectStatus")]
    pub subject_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjectStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_status_ext: Option<FieldExtension>,
    /** **The actual start and end time associated with this set of values associated with the encounter**

 The start and end time associated with this set of values associated with the encounter, may be different to the planned times for various reasons.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actualPeriod")]
    pub actual_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_period_ext: Option<FieldExtension>,
    /** **The planned start date/time (or admission date) of the encounter**

 The planned start date/time (or admission date) of the encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plannedStartDate")]
    pub planned_start_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plannedStartDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planned_start_date_ext: Option<FieldExtension>,
    /** **The planned end date/time (or discharge date) of the encounter**

 The planned end date/time (or discharge date) of the encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plannedEndDate")]
    pub planned_end_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plannedEndDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planned_end_date_ext: Option<FieldExtension>,
    /** **Actual quantity of time the encounter lasted (less time absent)**

 Actual quantity of time the encounter lasted. This excludes the time during leaves of absence.

When missing it is the time in between the start and end values.

 If the precision on these values is low (e.g. to the day only) then this may be considered was an all day (or multi-day) encounter, unless the duration is included, where that amount of time occurred sometime during the interval.

May differ from the time in `Encounter.period` due to leave of absence(s). */
    #[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>,
    /** **Location of the patient at this point in the encounter**

 The location of the patient at this point in the encounter, the multiple cardinality permits de-normalizing the levels of the location hierarchy, such as site/ward/room/bed.

 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<EncounterHistoryLocation>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl EncounterHistoryBuilder {
    #[doc = concat!("Finalize building ", "EncounterHistory", ".")]
    pub fn build(self) -> Result<EncounterHistory, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EncounterHistoryInner> for EncounterHistory {
    fn from(inner: EncounterHistoryInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EncounterHistory {
    type Target = EncounterHistoryInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EncounterHistory {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EncounterHistory {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EncounterHistoryBuilder {
        EncounterHistoryBuilder::default()
    }
}
impl EncounterHistory {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EncounterHistory
    }
}
/// Sub-fields of the location field in EncounterHistory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterHistoryLocationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterHistoryLocation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **[LocationForm](http://hl7.org/fhir/ValueSet/location-form); The physical type of the location (usually the level in the location hierarchy - bed, room, ward, virtual etc.)**

 This will be used to specify the required levels (bed/ward/room/etc.) desired to be recorded to simplify either messaging or query.

 This information is de-normalized from the Location resource to support the easier understanding of the encounter resource and processing in messaging or query.

There may be many levels in the hierachy, and this may only pic specific levels that are required for a specific usage scenario. */
    #[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>,
}
#[cfg(feature = "builders")]
impl EncounterHistoryLocation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterHistoryLocationBuilder {
        EncounterHistoryLocationBuilder::default()
    }
}
/** The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b, a REST endpoint for another FHIR server, or a s/Mime email address. This may include any security context information.

 **[Endpoint](http://hl7.org/fhir/StructureDefinition/Endpoint) v5.0.0**

 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, a REST endpoint for another FHIR server, or a s/Mime email address. This may include any security context information.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Endpoint(pub Box<EndpointInner>);
/** The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b, a REST endpoint for another FHIR server, or a s/Mime email address. This may include any security context information.

 **[Endpoint](http://hl7.org/fhir/StructureDefinition/Endpoint) v5.0.0**

 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, a REST endpoint for another FHIR server, or a s/Mime email address. 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 The endpoint status represents the general expected availability of an endpoint.

 This element is labeled as a modifier because the status contains codes that mark the endpoint as not currently valid. Temporary downtimes or other unexpected short-term changes in availability would not be represented in this property. */
    #[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. If there are multiple payload types or mimetypes they are all applicable for all connection types, and all have the same status. */
    #[serde(rename = "connectionType")]
    pub connection_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_connectionType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub connection_type_ext: Vec<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>,
    /** **Additional details about the endpoint that could be displayed as further information to identify the description beyond its name**

 The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing its usage/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>,
    /** **[endpoint-environment-type](http://hl7.org/fhir/ValueSet/endpoint-environment); The type of environment(s) exposed at this endpoint**

 The type of environment(s) exposed at this endpoint (dev, prod, test, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "environmentType")]
    pub environment_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_environmentType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub environment_type_ext: Vec<Option<FieldExtension>>,
    /** **Organization that manages this endpoint (might not be the organization that exposes the endpoint)**

 The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization 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 applicable 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 endpoint. 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.

 Temporary downtimes or other short-term changes in availability would not be represented in this property. */
    #[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>,
    /** **Set of payloads that are provided by this endpoint**

 The set of payloads that are provided/available at this endpoint.

 Note that not all mimetypes or types will be listed under the one endpoint resource, there may be multiple instances that information for cases where other header data such as the endpoint address, active status/period etc. is different. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payload")]
    pub payload: Vec<Option<EndpointPayload>>,
    /// 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>>,
    /** **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 there 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 depends 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
    }
}
/// Sub-fields of the payload field in Endpoint
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EndpointPayloadBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EndpointPayload {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[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 mimeType describes the serialization format of the data, where the payload.type indicates the specific document/schema that is being transferred; e.g. DischargeSummary or CarePlan. */
    #[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>>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); 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 = "mimeType")]
    pub mime_type: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mimeType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mime_type_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EndpointPayload {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EndpointPayloadBuilder {
        EndpointPayloadBuilder::default()
    }
}
/** This resource provides the insurance enrollment details to the insurer regarding a specified coverage.

 **[EnrollmentRequest](http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) v5.0.0**

 Enroll in coverage

 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>);
/** This resource provides the insurance enrollment details to the insurer regarding a specified coverage.

 **[EnrollmentRequest](http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) v5.0.0**

 Enroll in coverage

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **The subject to be enrolled**

 Patient Resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "candidate")]
    pub candidate: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_candidate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub candidate_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
    }
}
/** This resource provides enrollment and plan details from the processing of an EnrollmentRequest resource.

 **[EnrollmentResponse](http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) v5.0.0**

 EnrollmentResponse resource

 This resource provides enrollment and plan details from the processing of an EnrollmentRequest resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EnrollmentResponse(pub Box<EnrollmentResponseInner>);
/** This resource provides enrollment and plan details from the processing of an EnrollmentRequest resource.

 **[EnrollmentResponse](http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) v5.0.0**

 EnrollmentResponse resource

 This resource provides enrollment and plan details from the processing of an EnrollmentRequest 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **[EnrollmentOutcome](http://hl7.org/fhir/ValueSet/enrollment-outcome); queued | 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<String>,
    /// 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>,
}
#[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
    }
}
/** 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.

 **[EpisodeOfCare](http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) v5.0.0**

 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>);
/** 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.

 **[EpisodeOfCare](http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 medical reasons that are expected to be addressed during the episode of care**

 The list of medical reasons that are expected to be addressed during the episode of care.

 The reason communicates what medical problem the patient has that should be addressed during the episode of care.  This reason could be patient reported complaint, a clinical indication that was determined in a previous encounter or episode of care, or some planned care such as an immunization recommendation.  In the case where you have a primary reason, but are expecting to also address other problems, you can list the primary reason with a use code of 'Chief Complaint', while the other problems being addressed would have a use code of 'Reason for Visit'.

Examples:
 * pregnancy would use HealthcareService or a coding as the reason
 * patient home monitoring could use Condition as the reason */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<EpisodeOfCareReason>>,
    /// 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 medical conditions that were addressed during the episode of care**

 The list of medical conditions that were addressed during the episode of care.

 The diagnosis communicates what medical conditions were actually addressed during the episode of care.  If a diagnosis was provided as a reason, and was treated during the episode of care, it may be listed in both EpisodeOfCare.reason and EpisodeOfCare.diagnosis.

Diagnoses related to billing can be documented on the Account resources which supports ranking for the purpose of reimbursement. */
    #[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 responsibility for care coordination**

 The organization that has assumed the specific responsibilities for care coordination, care delivery, or other services for the specified duration.

 If multiple organizations are involved in care delivery, the care teams from those organizations would be represented in EpisodeOfCare.team, while the primary organization managing the care would be listed in EpisodeOfCare.managingOrganization.   Other organizations may have their own EpisodeOfCare for tracking their activities. */
    #[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 coordinator for the patient**

 The practitioner that is the care manager/care coordinator 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 = "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>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 reason 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 = "EpisodeOfCareReasonBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EpisodeOfCareReason {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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-use](http://hl7.org/fhir/ValueSet/encounter-reason-use); What the reason value should be used for/as**

 What the reason value should be used as e.g. Chief Complaint, Health Concern, Health Maintenance (including screening).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<CodeableConcept>,
    /// 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>,
    /** **[reason-code](http://hl7.org/fhir/ValueSet/encounter-reason); Medical reason to be addressed**

 The medical reason that is expected to be addressed during the episode of care, expressed as a text, code or a reference to another resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EpisodeOfCareReason {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EpisodeOfCareReasonBuilder {
        EpisodeOfCareReasonBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[condition-code](http://hl7.org/fhir/ValueSet/condition-code); The medical condition that was addressed during the episode of care**

 The medical condition that was addressed during the episode of care, expressed as a text, code or a reference to another resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[DiagnosisUse](http://hl7.org/fhir/ValueSet/encounter-diagnosis-use); 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 = "use")]
    pub r#use: Option<CodeableConcept>,
    /// 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 EpisodeOfCareDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EpisodeOfCareDiagnosisBuilder {
        EpisodeOfCareDiagnosisBuilder::default()
    }
}
/** The EventDefinition resource provides a reusable description of when a particular event can occur.

 **[EventDefinition](http://hl7.org/fhir/StructureDefinition/EventDefinition) v5.0.0**

 A description of when an event can occur

 The EventDefinition resource provides a reusable description of when a particular event can occur.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EventDefinition(pub Box<EventDefinitionInner>);
/** The EventDefinition resource provides a reusable description of when a particular event can occur.

 **[EventDefinition](http://hl7.org/fhir/StructureDefinition/EventDefinition) v5.0.0**

 A description of when an event can occur

 The EventDefinition resource provides a reusable description of when a particular event can occur.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EventDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EventDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EventDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EventDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this event definition, represented as a URI (globally unique)**

 An absolute URI that is used to identify this event definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this event definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the event definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 event definition**

 A formal identifier that is used to identify this event 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, and can then identify this event 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 event definition**

 The identifier that is used to identify this version of the event definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the event 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 event definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the event definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<EventDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<EventDefinitionVersionAlgorithmExtension>,
    /** **Name for this event definition (computer friendly)**

 A natural language name identifying the event 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 alphanumeric type name to ensure that it is machine-processing 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 event definition (human friendly)**

 A short, descriptive, user-friendly title for the event 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>,
    /** **Subordinate title of the event definition**

 An explanatory or alternate title for the event definition giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this event definition. Enables tracking the life-cycle of the content.

 Allows filtering of event definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 event definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of event definitions that are appropriate for use versus not. */
    #[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>,
    /** **Type of individual the event definition is focused on**

 A code or group definition that describes the intended subject of the event definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<EventDefinitionSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<EventDefinitionSubjectExtension>,
    /** **Date last changed**

 The date  (and optionally time) when the event definition was last significantly changed. The date must change 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 event definition changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the event definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the event definition.

 Usually an organization but may be an individual. The publisher (or steward) of the event definition is the organization or individual primarily responsible for the maintenance and upkeep of the event 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 event 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 event definition**

 A free text natural language description of the event definition from a consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the event 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 event definition is presumed to be the predominant language in the place the event definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate event definition instances.

 When multiple useContexts are specified, there is no expectation that 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 event definition (if applicable)**

 A legal or geographic region in which the event definition is intended to be used.

 It may be possible for the event definition to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 event definition is defined**

 Explanation of why this event definition is needed and why it has been designed as it has.

 This element does not describe the usage of the event 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 event 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 event definition**

 A detailed description of how the event definition 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>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the event definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the event definition.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the event 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 event definition was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 event definition is expected to be used**

 The period during which the event definition content was or is planned to be in active use.

 The effective period for an event definition  determines when the content is applicable for usage and is independent of publication and review dates. For example, a definition intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[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.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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 event occurs (multiple = 'or')**

 The trigger element defines when the event occurs. If more than one trigger condition is specified, the event fires whenever any one of the trigger conditions is met.

 */
    #[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>>,
}
#[cfg(feature = "builders")]
impl EventDefinitionBuilder {
    #[doc = concat!("Finalize building ", "EventDefinition", ".")]
    pub fn build(self) -> Result<EventDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EventDefinitionInner> for EventDefinition {
    fn from(inner: EventDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EventDefinition {
    type Target = EventDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EventDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EventDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EventDefinitionBuilder {
        EventDefinitionBuilder::default()
    }
}
impl EventDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EventDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in EventDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EventDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for EventDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EventDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in EventDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EventDefinitionSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
}
/// Extension value for EventDefinitionSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EventDefinitionSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
}
/** The Evidence Resource provides a machine-interpretable expression of an evidence concept including the evidence variables (e.g., population, exposures/interventions, comparators, outcomes, measured variables, confounding variables), the statistics, and the certainty of this evidence.

 **[Evidence](http://hl7.org/fhir/StructureDefinition/Evidence) v5.0.0**

 Single evidence bit

 The Evidence Resource provides a machine-interpretable expression of an evidence concept including the evidence variables (e.g., population, exposures/interventions, comparators, outcomes, measured variables, confounding variables), the statistics, and the certainty of this evidence.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Evidence(pub Box<EvidenceInner>);
/** The Evidence Resource provides a machine-interpretable expression of an evidence concept including the evidence variables (e.g., population, exposures/interventions, comparators, outcomes, measured variables, confounding variables), the statistics, and the certainty of this evidence.

 **[Evidence](http://hl7.org/fhir/StructureDefinition/Evidence) v5.0.0**

 Single evidence bit

 The Evidence Resource provides a machine-interpretable expression of an evidence concept including the evidence variables (e.g., population, exposures/interventions, comparators, outcomes, measured variables, confounding variables), the statistics, and the certainty of this evidence.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EvidenceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Evidence::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Evidence", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this evidence, represented as a globally unique URI**

 An absolute URI that is used to identify this evidence when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this summary is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the summary is stored on different servers.

 In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the meta.source element to indicate where the current master source of the resource can be found. */
    #[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 summary**

 A formal identifier that is used to identify this summary 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, and can then identify this summary 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 this summary**

 The identifier that is used to identify this version of the summary when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the summary 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.

 The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author. Considerations for making this decision are found in Technical and Business Versions. */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 is newer, and a 0 if the version ordering can't successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<EvidenceVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<EvidenceVersionAlgorithmExtension>,
    /** **Name for this summary (machine friendly)**

 A natural language name identifying the evidence. 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 alphanumeric type name to ensure that it is machine-processing 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 summary (human friendly)**

 A short, descriptive, user-friendly title for the summary.

 */
    #[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>,
    /** **Citation for this evidence**

 Citation Resource or display of suggested citation for this evidence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub cite_as: Option<EvidenceCiteAs>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cite_as_ext: Option<EvidenceCiteAsExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this summary. Enables tracking the life-cycle of the content.

 Allows filtering of summarys s that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 */
    #[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 last changed**

 The date  (and optionally time) when the summary was last significantly changed. The date must change 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 summary changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the summary. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **When the summary 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 summary was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **Name of the publisher/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the evidence.

 Usually an organization but may be an individual. The publisher (or steward) of the evidence is the organization or individual primarily responsible for the maintenance and upkeep of the evidence. 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 evidence. 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.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 authored the content**

 An individiual, organization, or device primarily involved in the creation and maintenance of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individiual, organization, or device primarily responsible for internal coherence of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individiual, organization, or device primarily responsible for review of some aspect of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individiual, organization, or device responsible for officially endorsing the content for use in some setting.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate evidence instances.

 When multiple useContexts are specified, there is no expectation that 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>>,
    /** **Why this Evidence is defined**

 Explanation of why this Evidence is needed and why it has been designed as it has.

 This element does not describe the usage of the Evidence. 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 Evidence. */
    #[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 Evidence and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the Evidence.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Link or citation to artifact associated with the summary**

 Link or citation to artifact associated with the summary.

 */
    #[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>>,
    /** **Description of the particular summary**

 A free text natural language description of the evidence from a consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the evidence 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 evidence is presumed to be the predominant language in the place the evidence 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>,
    /** **Declarative description of the Evidence**

 Declarative description of the Evidence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assertion")]
    pub assertion: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assertion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assertion_ext: Option<FieldExtension>,
    /** **Footnotes and/or explanatory notes**

 Footnotes and/or explanatory 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>>,
    /** **Evidence variable such as population, exposure, or outcome**

 Evidence variable such as population, exposure, or outcome.

 */
    #[serde(rename = "variableDefinition")]
    pub variable_definition: Vec<Option<EvidenceVariableDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_variableDefinition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub variable_definition_ext: Vec<Option<FieldExtension>>,
    /** **[SynthesisType](http://terminology.hl7.org/ValueSet/synthesis-type); The method to combine studies**

 The method to combine studies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "synthesisType")]
    pub synthesis_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_synthesisType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub synthesis_type_ext: Option<FieldExtension>,
    /** **[StudyDesign](http://hl7.org/fhir/ValueSet/study-design); The design of the study that produced this evidence**

 The design of the study that produced this evidence. The design is described with any number of study design characteristics.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "studyDesign")]
    pub study_design: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_studyDesign")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub study_design_ext: Vec<Option<FieldExtension>>,
    /** **Values and parameters for a single statistic**

 Values and parameters for a single statistic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statistic")]
    pub statistic: Vec<Option<EvidenceStatistic>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statistic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub statistic_ext: Vec<Option<FieldExtension>>,
    /** **Certainty or quality of the evidence**

 Assessment of certainty, confidence in the estimates, or quality of the evidence.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "certainty")]
    pub certainty: Vec<Option<EvidenceCertainty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_certainty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub certainty_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceBuilder {
    #[doc = concat!("Finalize building ", "Evidence", ".")]
    pub fn build(self) -> Result<Evidence, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EvidenceInner> for Evidence {
    fn from(inner: EvidenceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Evidence {
    type Target = EvidenceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Evidence {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Evidence {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EvidenceBuilder {
        EvidenceBuilder::default()
    }
}
impl Evidence {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Evidence
    }
}
/// Choice of types for the versionAlgorithm[x] field in Evidence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for EvidenceVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the citeAs[x] field in Evidence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceCiteAs {
    /// Variant accepting the Reference type.
    #[serde(rename = "citeAsReference")]
    Reference(Reference),
    /// Variant accepting the Markdown type.
    #[serde(rename = "citeAsMarkdown")]
    Markdown(String),
}
/// Extension value for EvidenceCiteAs.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceCiteAsExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_citeAsReference")]
    Reference(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_citeAsMarkdown")]
    Markdown(FieldExtension),
}
/// Sub-fields of the variableDefinition field in Evidence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableDefinition {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 text description or summary of the variable**

 A text description or summary of the variable.

 */
    #[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>,
    /** **Footnotes and/or explanatory notes**

 Footnotes and/or explanatory 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>>,
    /** **[EvidenceVariableRole](http://hl7.org/fhir/ValueSet/variable-role); population | subpopulation | exposure | referenceExposure | measuredVariable | confounder**

 population | subpopulation | exposure | referenceExposure | measuredVariable | confounder.

 */
    #[serde(rename = "variableRole")]
    pub variable_role: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variableRole")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variable_role_ext: Option<FieldExtension>,
    /** **Definition of the actual variable related to the statistic(s)**

 Definition of the actual variable related to the statistic(s).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observed")]
    pub observed: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observed_ext: Option<FieldExtension>,
    /** **Definition of the intended variable related to the Evidence**

 Definition of the intended variable related to the Evidence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intended")]
    pub intended: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intended")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intended_ext: Option<FieldExtension>,
    /** **[EvidenceDirectness](http://terminology.hl7.org/ValueSet/directness); low | moderate | high | exact**

 Indication of quality of match between intended variable to actual variable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "directnessMatch")]
    pub directness_match: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_directnessMatch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub directness_match_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableDefinition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableDefinitionBuilder {
        EvidenceVariableDefinitionBuilder::default()
    }
}
/// Sub-fields of the statistic field in Evidence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceStatisticBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceStatistic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of content**

 A description of the content value of the statistic.

 */
    #[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>,
    /** **Footnotes and/or explanatory notes**

 Footnotes and/or explanatory 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>>,
    /** **[StatisticType](http://hl7.org/fhir/ValueSet/statistic-type); Type of statistic, e.g., relative risk**

 Type of statistic, e.g., relative risk.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statisticType")]
    pub statistic_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statisticType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub statistic_type_ext: Option<FieldExtension>,
    /** **Associated category for categorical variable**

 When the measured variable is handled categorically, the category element is used to define which category the statistic is reporting.

 Simple strings can be used for descriptive purposes. Exact matching to EvidenceVariable.category.name for the Evidence.variableDefinition[variableRole=measuredVariable].observed=Reference(EvidenceVariable) could facilitate validation within datasets. */
    #[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>,
    /** **Statistic value**

 Statistic value.

 */
    #[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>,
    /** **The number of events associated with the statistic**

 The number of events associated with the statistic, where the unit of analysis is different from numberAffected, sampleSize.knownDataCount and sampleSize.numberOfParticipants.

 When the number of events is the statistic, use Evidence.statistic.quantity and set Evidence.statistic.type.coding.code=C25463 and Evidence.statistic.type.coding.display=Count. When the statistic is an Event Rate (where individual participants may have 2 or more events), use Evidence.statistic.numberOfEvents to record the total number of events rather than the number of participants with events. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfEvents")]
    pub number_of_events: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfEvents")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_events_ext: Option<FieldExtension>,
    /** **The number of participants affected**

 The number of participants affected where the unit of analysis is the same as sampleSize.knownDataCount and sampleSize.numberOfParticipants.

 When the number affected is the statistic, use Evidence.statistic.quantity and set Evidence.statistic.type.coding.code=C25463 and Evidence.statistic.type.coding.display=Count. When the statistic is a Proportion, use Evidence.statistic.numberAffected and enter an integer as the value. When the statistic is an Event Rate (where individual participants may have 2 or more events), use Evidence.statistic.numberAffected to record the number of participants with events rather than the total number of events. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberAffected")]
    pub number_affected: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberAffected")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_affected_ext: Option<FieldExtension>,
    /** **Number of samples in the statistic**

 Number of samples in the statistic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sampleSize")]
    pub sample_size: Option<EvidenceStatisticSampleSize>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sampleSize")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sample_size_ext: Option<FieldExtension>,
    /** **An attribute of the Statistic**

 A statistical attribute of the statistic such as a measure of heterogeneity.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attributeEstimate")]
    pub attribute_estimate: Vec<Option<EvidenceStatisticAttributeEstimate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attributeEstimate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attribute_estimate_ext: Vec<Option<FieldExtension>>,
    /** **An aspect of the statistical model**

 A component of the method to generate the statistic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modelCharacteristic")]
    pub model_characteristic: Vec<Option<EvidenceStatisticModelCharacteristic>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modelCharacteristic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub model_characteristic_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceStatistic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceStatisticBuilder {
        EvidenceStatisticBuilder::default()
    }
}
/// Sub-fields of the sampleSize field in EvidenceStatistic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceStatisticSampleSizeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceStatisticSampleSize {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 sample size for statistic**

 Human-readable summary of population sample size.

 */
    #[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>,
    /** **Footnote or explanatory note about the sample size**

 Footnote or explanatory note about the sample size.

 */
    #[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>>,
    /** **Number of contributing studies**

 Number of participants in the population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfStudies")]
    pub number_of_studies: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfStudies")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_studies_ext: Option<FieldExtension>,
    /** **Cumulative number of participants**

 A human-readable string to clarify or explain concepts about the sample size.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfParticipants")]
    pub number_of_participants: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfParticipants")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_participants_ext: Option<FieldExtension>,
    /** **Number of participants with known results for measured variables**

 Number of participants with known results for measured variables.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "knownDataCount")]
    pub known_data_count: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_knownDataCount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub known_data_count_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EvidenceStatisticSampleSize {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceStatisticSampleSizeBuilder {
        EvidenceStatisticSampleSizeBuilder::default()
    }
}
/// Sub-fields of the attributeEstimate field in EvidenceStatistic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceStatisticAttributeEstimateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceStatisticAttributeEstimate {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the attribute estimate**

 Human-readable summary of the estimate.

 */
    #[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>,
    /** **Footnote or explanatory note about the estimate**

 Footnote or explanatory note about the estimate.

 */
    #[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>>,
    /** **[AttributeEstimateType](http://hl7.org/fhir/ValueSet/attribute-estimate-type); The type of attribute estimate, e.g., confidence interval or p value**

 The type of attribute estimate, e.g., confidence interval or p value.

 */
    #[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 singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure**

 The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.

 Often the p value */
    #[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>,
    /** **Level of confidence interval, e.g., 0.95 for 95% confidence interval**

 Use 95 for a 95% confidence interval.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "level")]
    pub level: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_level")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub level_ext: Option<FieldExtension>,
    /** **Lower and upper bound values of the attribute estimate**

 Lower bound of confidence interval.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "range")]
    pub range: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_range")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub range_ext: Option<FieldExtension>,
    /** **A nested attribute estimate; which is the attribute estimate of an attribute estimate**

 A nested attribute estimate; which is the attribute estimate of an attribute estimate.

 A nested attribute estimate; which is the attribute estimate of an attribute estimate */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attributeEstimate")]
    pub attribute_estimate: Vec<Option<EvidenceStatisticAttributeEstimate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attributeEstimate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attribute_estimate_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceStatisticAttributeEstimate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceStatisticAttributeEstimateBuilder {
        EvidenceStatisticAttributeEstimateBuilder::default()
    }
}
/// Sub-fields of the modelCharacteristic field in EvidenceStatistic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceStatisticModelCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceStatisticModelCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[StatisticModelCode](http://hl7.org/fhir/ValueSet/statistic-model-code); Model specification**

 Description of a component of the method to generate the statistic.

 */
    #[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>,
    /** **Numerical value to complete model specification**

 Further specification of the quantified value of the component of the method to generate the statistic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<Quantity>,
    /// 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>,
    /** **A variable adjusted for in the adjusted analysis**

 A variable adjusted for in the adjusted analysis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variable")]
    pub variable: Vec<Option<EvidenceStatisticModelCharacteristicVariable>>,
    /// 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>>,
    /** **An attribute of the statistic used as a model characteristic**

 An attribute of the statistic used as a model characteristic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attributeEstimate")]
    pub attribute_estimate: Vec<Option<EvidenceStatisticAttributeEstimate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attributeEstimate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attribute_estimate_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceStatisticModelCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceStatisticModelCharacteristicBuilder {
        EvidenceStatisticModelCharacteristicBuilder::default()
    }
}
/// Sub-fields of the variable field in EvidenceStatisticModelCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceStatisticModelCharacteristicVariableBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceStatisticModelCharacteristicVariable {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of the variable**

 Description of the variable.

 */
    #[serde(rename = "variableDefinition")]
    pub variable_definition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variableDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variable_definition_ext: Option<FieldExtension>,
    /** **[EvidenceVariableHandling](http://hl7.org/fhir/ValueSet/variable-handling); continuous | dichotomous | ordinal | polychotomous**

 How the variable is classified for use in adjusted analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "handling")]
    pub handling: Option<codes::EvidenceVariableHandling>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_handling")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub handling_ext: Option<FieldExtension>,
    /** **Description for grouping of ordinal or polychotomous variables**

 Description for grouping of ordinal or polychotomous variables.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valueCategory")]
    pub value_category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valueCategory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_category_ext: Vec<Option<FieldExtension>>,
    /** **Discrete value for grouping of ordinal or polychotomous variables**

 Discrete value for grouping of ordinal or polychotomous variables.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valueQuantity")]
    pub value_quantity: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valueQuantity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_quantity_ext: Vec<Option<FieldExtension>>,
    /** **Range of values for grouping of ordinal or polychotomous variables**

 Range of values for grouping of ordinal or polychotomous variables.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valueRange")]
    pub value_range: Vec<Option<Range>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valueRange")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_range_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceStatisticModelCharacteristicVariable {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceStatisticModelCharacteristicVariableBuilder {
        EvidenceStatisticModelCharacteristicVariableBuilder::default()
    }
}
/// Sub-fields of the certainty field in Evidence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceCertaintyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceCertainty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 certainty**

 Textual description of certainty.

 */
    #[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>,
    /** **Footnotes and/or explanatory notes**

 Footnotes and/or explanatory 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>>,
    /** **[EvidenceCertaintyType](http://hl7.org/fhir/ValueSet/certainty-type); Aspect of certainty being rated**

 Aspect of certainty being rated.

 */
    #[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>,
    /** **[EvidenceCertaintyRating](http://hl7.org/fhir/ValueSet/certainty-rating); Assessment or judgement of the aspect**

 Assessment or judgement of the aspect.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rating")]
    pub rating: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rating")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rating_ext: Option<FieldExtension>,
    /** **Individual or group who did the rating**

 Individual or group who did the rating.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rater")]
    pub rater: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rater")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rater_ext: Option<FieldExtension>,
    /** **A domain or subdomain of certainty**

 A domain or subdomain of certainty.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subcomponent")]
    pub subcomponent: Vec<Option<EvidenceCertainty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subcomponent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subcomponent_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceCertainty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceCertaintyBuilder {
        EvidenceCertaintyBuilder::default()
    }
}
/** The EvidenceReport Resource is a specialized container for a collection of resources and codeable concepts, adapted to support compositions of Evidence, EvidenceVariable, and Citation resources and related concepts.

 **[EvidenceReport](http://hl7.org/fhir/StructureDefinition/EvidenceReport) v5.0.0**

 A EvidenceReport

 The EvidenceReport Resource is a specialized container for a collection of resources and codeable concepts, adapted to support compositions of Evidence, EvidenceVariable, and Citation resources and related concepts.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EvidenceReport(pub Box<EvidenceReportInner>);
/** The EvidenceReport Resource is a specialized container for a collection of resources and codeable concepts, adapted to support compositions of Evidence, EvidenceVariable, and Citation resources and related concepts.

 **[EvidenceReport](http://hl7.org/fhir/StructureDefinition/EvidenceReport) v5.0.0**

 A EvidenceReport

 The EvidenceReport Resource is a specialized container for a collection of resources and codeable concepts, adapted to support compositions of Evidence, EvidenceVariable, and Citation resources and related concepts.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EvidenceReportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EvidenceReport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EvidenceReport", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this EvidenceReport, represented as a globally unique URI**

 An absolute URI that is used to identify this EvidenceReport when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this summary is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the summary is stored on different servers.

 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>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this summary. Enables tracking the life-cycle of the content.

 Allows filtering of summaries that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate evidence report instances.

 When multiple useContexts are specified, there is no expectation that 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>>,
    /** **Unique identifier for the evidence report**

 A formal identifier that is used to identify this EvidenceReport when it is represented in other formats, or referenced in a specification, model, design or an instance.

 This element will contain unique identifiers that support de-duplication of EvidenceReports. This identifier can be valid for only one EvidenceReport resource. */
    #[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>>,
    /** **Identifiers for articles that may relate to more than one evidence report**

 A formal identifier that is used to identify things closely related to this EvidenceReport.

 May include trial registry identifiers, e.g. NCT04372602 from clinicaltrials.gov. This identifier can be valid for multiple EvidenceReport resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedIdentifier")]
    pub related_identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedIdentifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_identifier_ext: Vec<Option<FieldExtension>>,
    /** **Citation for this report**

 Citation Resource or display of suggested citation for this report.

 used for reports for which external citation is expected, such as use in support of scholarly publications. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub cite_as: Option<EvidenceReportCiteAs>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cite_as_ext: Option<EvidenceReportCiteAsExtension>,
    /** **[EvidenceReportType](http://hl7.org/fhir/ValueSet/evidence-report-type); Kind of report**

 Specifies the kind of report, such as grouping of classifiers, search results, or human-compiled expression.

 */
    #[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>,
    /** **Used for footnotes and annotations**

 Used for footnotes and annotations.

 */
    #[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>>,
    /** **Link, description or reference to artifact associated with the report**

 Link, description or reference to artifact associated with the report.

 */
    #[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>>,
    /** **Focus of the report**

 Specifies the subject or focus of the report. Answers "What is this report about?".

 May be used as an expression for search queries and search results */
    #[serde(rename = "subject")]
    pub subject: EvidenceReportSubject,
    /// 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>,
    /** **Name of the publisher/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the evidence report.

 Usually an organization but may be an individual. The publisher (or steward) of the evidence report is the organization or individual primarily responsible for the maintenance and upkeep of the evidence report. 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 evidence report. 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.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 authored the content**

 An individiual, organization, or device primarily involved in the creation and maintenance of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individiual, organization, or device primarily responsible for internal coherence of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individiual, organization, or device primarily responsible for review of some aspect of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individiual, organization, or device responsible for officially endorsing the content for use in some setting.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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<EvidenceReportRelatesTo>>,
    /// 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>>,
    /** **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<EvidenceReportSection>>,
    /// 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 EvidenceReportBuilder {
    #[doc = concat!("Finalize building ", "EvidenceReport", ".")]
    pub fn build(self) -> Result<EvidenceReport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EvidenceReportInner> for EvidenceReport {
    fn from(inner: EvidenceReportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EvidenceReport {
    type Target = EvidenceReportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EvidenceReport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EvidenceReport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EvidenceReportBuilder {
        EvidenceReportBuilder::default()
    }
}
impl EvidenceReport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EvidenceReport
    }
}
/// Choice of types for the citeAs[x] field in EvidenceReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceReportCiteAs {
    /// Variant accepting the Reference type.
    #[serde(rename = "citeAsReference")]
    Reference(Reference),
    /// Variant accepting the Markdown type.
    #[serde(rename = "citeAsMarkdown")]
    Markdown(String),
}
/// Extension value for EvidenceReportCiteAs.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceReportCiteAsExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_citeAsReference")]
    Reference(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_citeAsMarkdown")]
    Markdown(FieldExtension),
}
/// Sub-fields of the subject field in EvidenceReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportSubjectBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceReportSubject {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Characteristic**

 Characteristic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<EvidenceReportSubjectCharacteristic>>,
    /// 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>>,
    /** **Footnotes and/or explanatory notes**

 Used for general notes and annotations not coded 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 EvidenceReportSubject {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceReportSubjectBuilder {
        EvidenceReportSubjectBuilder::default()
    }
}
/// Sub-fields of the characteristic field in EvidenceReportSubject
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportSubjectCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceReportSubjectCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FocusCharacteristicCode](http://hl7.org/fhir/ValueSet/focus-characteristic-code); Characteristic code**

 Characteristic code.

 Example 1 is a Citation. Example 2 is a type of outcome. Example 3 is a specific outcome. */
    #[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>,
    /** **Characteristic value**

 Characteristic value.

 Example 1 is Citation #37. Example 2 is selecting clinical outcomes. Example 3 is 1-year mortality. */
    #[serde(flatten)]
    pub value: EvidenceReportSubjectCharacteristicValue,
    /// 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<EvidenceReportSubjectCharacteristicValueExtension>,
    /** **Is used to express not the characteristic**

 Is used to express not the characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclude")]
    pub exclude: Option<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>,
    /** **Timeframe for the characteristic**

 Timeframe for the characteristic.

 */
    #[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 EvidenceReportSubjectCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceReportSubjectCharacteristicBuilder {
        EvidenceReportSubjectCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in EvidenceReportSubjectCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceReportSubjectCharacteristicValue {
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
    /// 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 EvidenceReportSubjectCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceReportSubjectCharacteristicValueExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
    /// 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 relatesTo field in EvidenceReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportRelatesToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceReportRelatesTo {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ReportRelationshipType](http://hl7.org/fhir/ValueSet/report-relation-type); replaces | amends | appends | transforms | replacedWith | amendedWith | appendedWith | transformedWith**

 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::ReportRelationshipType,
    /// 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(rename = "target")]
    pub target: EvidenceReportRelatesToTarget,
    /// 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 EvidenceReportRelatesTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceReportRelatesToBuilder {
        EvidenceReportRelatesToBuilder::default()
    }
}
/// Sub-fields of the target field in EvidenceReportRelatesTo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportRelatesToTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceReportRelatesToTarget {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the relationship URL**

 Target of the relationship URL.

 */
    #[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>,
    /** **Target of the relationship Identifier**

 Target of the relationship 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>,
    /** **Target of the relationship Display**

 Target of the relationship Display.

 */
    #[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>,
    /** **Target of the relationship Resource reference**

 Target of the relationship Resource reference.

 */
    #[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 EvidenceReportRelatesToTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceReportRelatesToTargetBuilder {
        EvidenceReportRelatesToTargetBuilder::default()
    }
}
/// Sub-fields of the section field in EvidenceReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceReportSectionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceReportSection {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. */
    #[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>,
    /** **[ReportSectionType](http://hl7.org/fhir/ValueSet/evidence-report-section); Classification of section (recommended)**

 A code identifying the kind of content contained within the section. This should 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 = "focus")]
    pub focus: Option<CodeableConcept>,
    /// 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>,
    /** **Classification of section by Resource**

 A definitional Resource identifying the kind of content contained within the section. This should be consistent with the section title.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focusReference")]
    pub focus_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_focusReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub focus_reference_ext: Option<FieldExtension>,
    /** **Who and/or what authored the section**

 Identifies who is responsible for the information in this section, not necessarily who typed it in.

 */
    #[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>>,
    /** **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 peferred to contain sufficient detail to make it acceptable for a human to just read the narrative.

 Document profiles may define what content should be represented in the narrative. */
    #[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 misunderstood 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>,
    /** **[EvidenceClassifier](http://hl7.org/fhir/ValueSet/evidence-classifier-code); Extensible classifiers as content**

 Specifies any type of classification of the evidence report.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entryClassifier")]
    pub entry_classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entryClassifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_classifier_ext: Vec<Option<FieldExtension>>,
    /** **Reference to resources as content**

 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 = "entryReference")]
    pub entry_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entryReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_reference_ext: Vec<Option<FieldExtension>>,
    /** **Quantity as content**

 Quantity as content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entryQuantity")]
    pub entry_quantity: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entryQuantity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_quantity_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<EvidenceReportSection>>,
    /// 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 EvidenceReportSection {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceReportSectionBuilder {
        EvidenceReportSectionBuilder::default()
    }
}
/** The EvidenceVariable resource describes an element that knowledge (Evidence) is about.

 **[EvidenceVariable](http://hl7.org/fhir/StructureDefinition/EvidenceVariable) v5.0.0**

 A definition of an exposure, outcome, or other variable

 The EvidenceVariable resource describes an element that knowledge (Evidence) is about.

 The EvidenceVariable may be an exposure variable (intervention, condition, or state), a measured variable (outcome or observed parameter), or other variable (such as confounding factor). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EvidenceVariable(pub Box<EvidenceVariableInner>);
/** The EvidenceVariable resource describes an element that knowledge (Evidence) is about.

 **[EvidenceVariable](http://hl7.org/fhir/StructureDefinition/EvidenceVariable) v5.0.0**

 A definition of an exposure, outcome, or other variable

 The EvidenceVariable resource describes an element that knowledge (Evidence) is about.

 The EvidenceVariable may be an exposure variable (intervention, condition, or state), a measured variable (outcome or observed parameter), or other variable (such as confounding factor). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EvidenceVariableInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EvidenceVariable::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EvidenceVariable", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this evidence variable, represented as a URI (globally unique)**

 An absolute URI that is used to identify this evidence variable when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this evidence variable is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the evidence variable is stored on different servers.

 In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the meta.source element to indicate where the current master source of the resource can be found. */
    #[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 evidence variable**

 A formal identifier that is used to identify this evidence variable 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, and can then identify this evidence variable 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 evidence variable**

 The identifier that is used to identify this version of the evidence variable when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the evidence variable 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 evidence variable instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the evidence variable with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 is newer, and a 0 if the version ordering can't successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<EvidenceVariableVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<EvidenceVariableVersionAlgorithmExtension>,
    /** **Name for this evidence variable (computer friendly)**

 A natural language name identifying the evidence variable. 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 alphanumeric type name to ensure that it is machine-processing 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 evidence variable (human friendly)**

 A short, descriptive, user-friendly title for the evidence variable.

 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>,
    /** **Title for use in informal contexts**

 The short title provides an alternate title for use in informal descriptive contexts where the full, formal title is not necessary.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "shortTitle")]
    pub short_title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_shortTitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub short_title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this evidence variable. Enables tracking the life-cycle of the content.

 Allows filtering of evidence variables that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 */
    #[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 last changed**

 The date  (and optionally time) when the evidence variable was last significantly changed. The date must change 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 evidence variable changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the evidence variable. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the evidence variable.

 Usually an organization but may be an individual. The publisher (or steward) of the evidence variable is the organization or individual primarily responsible for the maintenance and upkeep of the evidence variable. 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 evidence variable. 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.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 evidence variable**

 A free text natural language description of the evidence variable from a consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the evidence variable 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 evidence variable is presumed to be the predominant language in the place the evidence variable 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>,
    /** **Used for footnotes or explanatory notes**

 A human-readable string to clarify or explain concepts about the resource.

 */
    #[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>>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate evidence variable instances.

 When multiple useContexts are specified, there is no expectation that 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>>,
    /** **Why this EvidenceVariable is defined**

 Explanation of why this EvidenceVariable is needed and why it has been designed as it has.

 This element does not describe the usage of the EvidenceVariable. 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 EvidenceVariable. */
    #[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 resource and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the resource.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the resource 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization).

 */
    #[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 resource was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 resource is expected to be used**

 The period during which the resource content was or is planned to be in active use.

 The effective period for an EvidenceVariable determines when the content is applicable for usage and is independent of publication and review dates. For example, a variable intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 Extensions to ContactDetail include: contactReference, contactAddress, and contributionTime (see [Clinical Reasoning Module](clinicalreasoning-module.html)).

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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>>,
    /** **Actual or conceptual**

 True if the actual variable measured, false if a conceptual representation of the intended variable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actual")]
    pub actual: Option<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>,
    /** **A defining factor of the EvidenceVariable**

 A defining factor of the EvidenceVariable. Multiple characteristics are applied with "and" semantics.

 Characteristics can be defined flexibly to accommodate different use cases for membership criteria, ranging from simple codes, all the way to using an expression language to express the criteria. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<EvidenceVariableCharacteristic>>,
    /// 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>>,
    /** **[EvidenceVariableHandling](http://hl7.org/fhir/ValueSet/variable-handling); continuous | dichotomous | ordinal | polychotomous**

 The method of handling in statistical analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "handling")]
    pub handling: Option<codes::EvidenceVariableHandling>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_handling")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub handling_ext: Option<FieldExtension>,
    /** **A grouping for ordinal or polychotomous variables**

 A grouping for ordinal or polychotomous variables.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<EvidenceVariableCategory>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableBuilder {
    #[doc = concat!("Finalize building ", "EvidenceVariable", ".")]
    pub fn build(self) -> Result<EvidenceVariable, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EvidenceVariableInner> for EvidenceVariable {
    fn from(inner: EvidenceVariableInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EvidenceVariable {
    type Target = EvidenceVariableInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EvidenceVariable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EvidenceVariable {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EvidenceVariableBuilder {
        EvidenceVariableBuilder::default()
    }
}
impl EvidenceVariable {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EvidenceVariable
    }
}
/// Choice of types for the versionAlgorithm[x] field in EvidenceVariable
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for EvidenceVariableVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the characteristic field in EvidenceVariable
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 internal linking**

 Label used for when a characteristic refers to another characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **Natural language description of the characteristic**

 A short, natural language description of the characteristic that could be used to communicate the criteria to an end-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>,
    /** **Used for footnotes or explanatory notes**

 A human-readable string to clarify or explain concepts about the characteristic.

 */
    #[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>>,
    /** **Whether the characteristic is an inclusion criterion or exclusion criterion**

 When true, this characteristic is an exclusion criterion. In other words, not matching this characteristic definition is equivalent to meeting this criterion.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclude")]
    pub exclude: Option<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>,
    /** **Defines the characteristic (without using type and value) by a Reference**

 Defines the characteristic using a Reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionReference")]
    pub definition_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_reference_ext: Option<FieldExtension>,
    /** **Defines the characteristic (without using type and value) by a Canonical**

 Defines the characteristic using Canonical.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionCanonical")]
    pub definition_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_canonical_ext: Option<FieldExtension>,
    /** **Defines the characteristic (without using type and value) by a CodeableConcept**

 Defines the characteristic using CodeableConcept.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionCodeableConcept")]
    pub definition_codeable_concept: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionCodeableConcept")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_codeable_concept_ext: Option<FieldExtension>,
    /** **Defines the characteristic (without using type and value) by an expression**

 Defines the characteristic using Expression.

 When another element provides a definition of the characteristic, the definitionExpression content SHALL match the definition (only adding technical concepts necessary for implementation) without changing the meaning. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionExpression")]
    pub definition_expression: Option<Expression>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionExpression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_expression_ext: Option<FieldExtension>,
    /** **Defines the characteristic (without using type and value) by an id**

 Defines the characteristic using id.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionId")]
    pub definition_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_id_ext: Option<FieldExtension>,
    /** **Defines the characteristic using type and value**

 Defines the characteristic using both a type and value[x] elements.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionByTypeAndValue")]
    pub definition_by_type_and_value: Option<
        EvidenceVariableCharacteristicDefinitionByTypeAndValue,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionByTypeAndValue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_by_type_and_value_ext: Option<FieldExtension>,
    /** **Used to specify how two or more characteristics are combined**

 Defines the characteristic as a combination of two or more characteristics.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitionByCombination")]
    pub definition_by_combination: Option<
        EvidenceVariableCharacteristicDefinitionByCombination,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitionByCombination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_by_combination_ext: Option<FieldExtension>,
    /** **Number of occurrences meeting the characteristic**

 Number of occurrences meeting the characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub instances: Option<EvidenceVariableCharacteristicInstances>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instances_ext: Option<EvidenceVariableCharacteristicInstancesExtension>,
    /** **Length of time in which the characteristic is met**

 Length of time in which the characteristic is met.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub duration: Option<EvidenceVariableCharacteristicDuration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub duration_ext: Option<EvidenceVariableCharacteristicDurationExtension>,
    /** **Timing in which the characteristic is determined**

 Timing in which the characteristic is determined.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timeFromEvent")]
    pub time_from_event: Vec<Option<EvidenceVariableCharacteristicTimeFromEvent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_timeFromEvent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub time_from_event_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableCharacteristicBuilder {
        EvidenceVariableCharacteristicBuilder::default()
    }
}
/// Sub-fields of the definitionByTypeAndValue field in EvidenceVariableCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableCharacteristicDefinitionByTypeAndValueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableCharacteristicDefinitionByTypeAndValue {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[UsageContextType](http://terminology.hl7.org/ValueSet/usage-context-type); Expresses the type of characteristic**

 Used to express the type of characteristic.

 */
    #[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>,
    /** **[DefinitionMethod](http://hl7.org/fhir/ValueSet/definition-method); Method for how the characteristic value was determined**

 Method for how the characteristic value was determined.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub method_ext: Vec<Option<FieldExtension>>,
    /** **Device used for determining characteristic**

 Device used for determining characteristic.

 */
    #[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>,
    /** **Defines the characteristic when coupled with characteristic.type**

 Defines the characteristic when paired with characteristic.type.

 */
    #[serde(flatten)]
    pub value: EvidenceVariableCharacteristicDefinitionByTypeAndValueValue,
    /// 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<
        EvidenceVariableCharacteristicDefinitionByTypeAndValueValueExtension,
    >,
    /** **[CharacteristicOffset](http://hl7.org/fhir/ValueSet/characteristic-offset); Reference point for valueQuantity or valueRange**

 Defines the reference point for comparison when valueQuantity or valueRange is not compared to zero.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "offset")]
    pub offset: Option<CodeableConcept>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableCharacteristicDefinitionByTypeAndValue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableCharacteristicDefinitionByTypeAndValueBuilder {
        EvidenceVariableCharacteristicDefinitionByTypeAndValueBuilder::default()
    }
}
/// Choice of types for the value[x] field in EvidenceVariableCharacteristicDefinitionByTypeAndValue
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicDefinitionByTypeAndValueValue {
    /// 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),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
    /// Variant accepting the Id type.
    #[serde(rename = "valueId")]
    Id(String),
}
/// Extension value for EvidenceVariableCharacteristicDefinitionByTypeAndValueValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicDefinitionByTypeAndValueValueExtension {
    /// 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),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_valueId")]
    Id(FieldExtension),
}
/// Sub-fields of the definitionByCombination field in EvidenceVariableCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableCharacteristicDefinitionByCombinationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableCharacteristicDefinitionByCombination {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CharacteristicCombination](http://hl7.org/fhir/ValueSet/characteristic-combination); all-of | any-of | at-least | at-most | statistical | net-effect | dataset**

 Used to specify if two or more characteristics are combined with OR or AND.

 */
    #[serde(rename = "code")]
    pub code: codes::CharacteristicCombination,
    /// 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>,
    /** **Provides the value of "n" when "at-least" or "at-most" codes are used**

 Provides the value of "n" when "at-least" or "at-most" codes are used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "threshold")]
    pub threshold: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_threshold")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub threshold_ext: Option<FieldExtension>,
    /** **A defining factor of the characteristic**

 A defining factor of the characteristic.

 */
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<EvidenceVariableCharacteristic>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableCharacteristicDefinitionByCombination {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableCharacteristicDefinitionByCombinationBuilder {
        EvidenceVariableCharacteristicDefinitionByCombinationBuilder::default()
    }
}
/// Choice of types for the instances[x] field in EvidenceVariableCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicInstances {
    /// Variant accepting the Quantity type.
    #[serde(rename = "instancesQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "instancesRange")]
    Range(Range),
}
/// Extension value for EvidenceVariableCharacteristicInstances.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicInstancesExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_instancesQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_instancesRange")]
    Range(FieldExtension),
}
/// Choice of types for the duration[x] field in EvidenceVariableCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicDuration {
    /// Variant accepting the Quantity type.
    #[serde(rename = "durationQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "durationRange")]
    Range(Range),
}
/// Extension value for EvidenceVariableCharacteristicDuration.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicDurationExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_durationQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_durationRange")]
    Range(FieldExtension),
}
/// Sub-fields of the timeFromEvent field in EvidenceVariableCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableCharacteristicTimeFromEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableCharacteristicTimeFromEvent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 description**

 Human readable 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>,
    /** **Used for footnotes or explanatory notes**

 A human-readable string to clarify or explain concepts about the timeFromEvent.

 */
    #[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>>,
    /** **The event used as a base point (reference point) in time**

 The event used as a base point (reference point) in time.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub event: Option<EvidenceVariableCharacteristicTimeFromEventEvent>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_ext: Option<EvidenceVariableCharacteristicTimeFromEventEventExtension>,
    /** **Used to express the observation at a defined amount of time before or after the event**

 Used to express the observation at a defined amount of time before or after the event.

 */
    #[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>,
    /** **Used to express the observation within a period before and/or after the event**

 Used to express the observation within a period before and/or after the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "range")]
    pub range: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_range")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub range_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableCharacteristicTimeFromEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableCharacteristicTimeFromEventBuilder {
        EvidenceVariableCharacteristicTimeFromEventBuilder::default()
    }
}
/// Choice of types for the event[x] field in EvidenceVariableCharacteristicTimeFromEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicTimeFromEventEvent {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "eventCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "eventReference")]
    Reference(Reference),
    /// Variant accepting the DateTime type.
    #[serde(rename = "eventDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Id type.
    #[serde(rename = "eventId")]
    Id(String),
}
/// Extension value for EvidenceVariableCharacteristicTimeFromEventEvent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCharacteristicTimeFromEventEventExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_eventCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_eventReference")]
    Reference(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_eventDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_eventId")]
    Id(FieldExtension),
}
/// Sub-fields of the category field in EvidenceVariable
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EvidenceVariableCategoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EvidenceVariableCategory {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of the grouping**

 Description of the grouping.

 */
    #[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>,
    /** **Definition of the grouping**

 Definition of the grouping.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<EvidenceVariableCategoryValue>,
    /// 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<EvidenceVariableCategoryValueExtension>,
}
#[cfg(feature = "builders")]
impl EvidenceVariableCategory {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EvidenceVariableCategoryBuilder {
        EvidenceVariableCategoryBuilder::default()
    }
}
/// Choice of types for the value[x] field in EvidenceVariableCategory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCategoryValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
}
/// Extension value for EvidenceVariableCategoryValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EvidenceVariableCategoryValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
}
/** A walkthrough of a workflow showing the interaction between systems and the instances shared, possibly including the evolution of instances over time.

 **[ExampleScenario](http://hl7.org/fhir/StructureDefinition/ExampleScenario) v5.0.0**

 Example of workflow instance

 Example of workflow instance.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ExampleScenario(pub Box<ExampleScenarioInner>);
/** A walkthrough of a workflow showing the interaction between systems and the instances shared, possibly including the evolution of instances over time.

 **[ExampleScenario](http://hl7.org/fhir/StructureDefinition/ExampleScenario) v5.0.0**

 Example of workflow instance

 Example of workflow instance.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ExampleScenarioInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ExampleScenario::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ExampleScenario", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this example scenario, represented as a URI (globally unique)**

 An absolute URI that is used to identify this example scenario when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this example scenario is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the example scenario is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 example scenario**

 A formal identifier that is used to identify this example scenario 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, and can then identify this example scenario 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 example scenario**

 The identifier that is used to identify this version of the example scenario when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the example scenario 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 example scenario instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the example scenario with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ExampleScenarioVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ExampleScenarioVersionAlgorithmExtension>,
    /** **To be removed?**

 Temporarily retained for tooling purposes.

 Not needed as code will never be generated from one of these */
    #[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 example scenario (human friendly)**

 A short, descriptive, user-friendly title for the ExampleScenario.

 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 example scenario. Enables tracking the life-cycle of the content.

 Allows filtering of example scenarios that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 example scenario is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of example scenarios that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the example scenario was last significantly changed. The date must change 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 example scenario changes. (e.g. the 'content logical definition').

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the example scenario. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the example scenario.

 Usually an organization but may be an individual. The publisher (or steward) of the example scenario is the organization or individual primarily responsible for the maintenance and upkeep of the example scenario. 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 example scenario. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ExampleScenario**

 A free text natural language description of the ExampleScenario from a consumer's perspective.

 This description can be used to capture details such as comments about misuse. It is not a rendering of the ExampleScenario as conveyed in the 'text' field of the resource 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate example scenario instances.

 When multiple useContexts are specified, there is no expectation that 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 example scenario (if applicable)**

 A legal or geographic region in which the example scenario is intended to be used.

 It may be possible for the example scenario to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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>>,
    /** **The purpose of the example, e.g. to illustrate a scenario**

 What the example scenario resource is created for. This should not be used to show the business purpose of the scenario itself, but the purpose of documenting a scenario.

 This element does not describe the usage of the example scenario. 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 example scenario. */
    #[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 example scenario and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the example scenario.

 ... */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Individual involved in exchange**

 A system or person who shares or receives an instance within the scenario.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Vec<Option<ExampleScenarioActor>>,
    /// 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>>,
    /** **Data used in the scenario**

 A single data collection that is shared as part of the scenario.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<ExampleScenarioInstance>>,
    /// 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>>,
    /** **Major process within scenario**

 A group of operations that represents a significant step within a scenario.

 Some scenarios might describe only one process. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "process")]
    pub process: Vec<Option<ExampleScenarioProcess>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_process")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub process_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioBuilder {
    #[doc = concat!("Finalize building ", "ExampleScenario", ".")]
    pub fn build(self) -> Result<ExampleScenario, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ExampleScenarioInner> for ExampleScenario {
    fn from(inner: ExampleScenarioInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ExampleScenario {
    type Target = ExampleScenarioInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ExampleScenario {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ExampleScenario {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ExampleScenarioBuilder {
        ExampleScenarioBuilder::default()
    }
}
impl ExampleScenario {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ExampleScenario
    }
}
/// Choice of types for the versionAlgorithm[x] field in ExampleScenario
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExampleScenarioVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ExampleScenarioVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExampleScenarioVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the actor field in ExampleScenario
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioActorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioActor {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or acronym of the actor**

 A unique string within the scenario that is used to reference the actor.

 */
    #[serde(rename = "key")]
    pub key: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_key")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub key_ext: Option<FieldExtension>,
    /** **[ExampleScenarioActorType](http://hl7.org/fhir/ValueSet/examplescenario-actor-type); person | system**

 The category of actor - person or system.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ExampleScenarioActorType,
    /// 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>,
    /** **Label for actor when rendering**

 The human-readable name for the actor used when rendering the scenario.

 */
    #[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>,
    /** **Details about actor**

 An explanation of who/what the actor is and its role in the scenario.

 */
    #[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 ExampleScenarioActor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioActorBuilder {
        ExampleScenarioActorBuilder::default()
    }
}
/// Sub-fields of the instance field in ExampleScenario
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioInstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or acronym of the instance**

 A unique string within the scenario that is used to reference the instance.

 */
    #[serde(rename = "key")]
    pub key: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_key")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub key_ext: Option<FieldExtension>,
    /** **[InstanceType](http://hl7.org/fhir/ValueSet/examplescenario-instance-type); Data structure for example**

 A code indicating the kind of data structure (FHIR resource or some other standard) this is an instance of.

 */
    #[serde(rename = "structureType")]
    pub structure_type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_structureType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub structure_type_ext: Option<FieldExtension>,
    /** **E.g. 4.0.1**

 Conveys the version of the data structure instantiated.  I.e. what release of FHIR, X12, OpenEHR, etc. is instance compliant with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "structureVersion")]
    pub structure_version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_structureVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub structure_version_ext: Option<FieldExtension>,
    /** **Rules instance adheres to**

 Refers to a profile, template or other ruleset the instance adheres to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub structure_profile: Option<ExampleScenarioInstanceStructureProfile>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub structure_profile_ext: Option<ExampleScenarioInstanceStructureProfileExtension>,
    /** **Label for instance**

 A short descriptive label the instance to be used in tables or diagrams.

 */
    #[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>,
    /** **Human-friendly description of the instance**

 An explanation of what the instance contains and what it's for.

 */
    #[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>,
    /** **Example instance data**

 Points to an instance (typically an example) that shows the data that would corespond to this instance.

 If not conveying FHIR data or not using the same version of FHIR as this ExampleScenario instance, the reference must be to a Binary. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Option<Reference>,
    /// 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>,
    /** **Snapshot of instance that changes**

 Represents the instance as it was at a specific time-point.

 Not used if an instance doesn't change */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Vec<Option<ExampleScenarioInstanceVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub version_ext: Vec<Option<FieldExtension>>,
    /** **Resources contained in the instance**

 References to other instances that can be found within this instance (e.g. the observations contained in a bundle).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "containedInstance")]
    pub contained_instance: Vec<Option<ExampleScenarioInstanceContainedInstance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_containedInstance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contained_instance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioInstanceBuilder {
        ExampleScenarioInstanceBuilder::default()
    }
}
/// Choice of types for the structureProfile[x] field in ExampleScenarioInstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExampleScenarioInstanceStructureProfile {
    /// Variant accepting the Canonical type.
    #[serde(rename = "structureProfileCanonical")]
    Canonical(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "structureProfileUri")]
    Uri(String),
}
/// Extension value for ExampleScenarioInstanceStructureProfile.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExampleScenarioInstanceStructureProfileExtension {
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_structureProfileCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_structureProfileUri")]
    Uri(FieldExtension),
}
/// Sub-fields of the version field in ExampleScenarioInstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioInstanceVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioInstanceVersion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or acronym of the version**

 A unique string within the instance that is used to reference the version of the instance.

 */
    #[serde(rename = "key")]
    pub key: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_key")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub key_ext: Option<FieldExtension>,
    /** **Label for instance version**

 A short descriptive label the version to be used in tables or diagrams.

 */
    #[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>,
    /** **Details about version**

 An explanation of what this specific version of the instance contains and represents.

 */
    #[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>,
    /** **Example instance version data**

 Points to an instance (typically an example) that shows the data that would flow at this point in the scenario.

 If not conveying FHIR data or not using the same version of FHIR as this ExampleScenario instance, the reference must be to a Binary. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Option<Reference>,
    /// 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 ExampleScenarioInstanceVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioInstanceVersionBuilder {
        ExampleScenarioInstanceVersionBuilder::default()
    }
}
/// Sub-fields of the containedInstance field in ExampleScenarioInstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioInstanceContainedInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioInstanceContainedInstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Key of contained instance**

 A reference to the key of an instance found within this one.

 */
    #[serde(rename = "instanceReference")]
    pub instance_reference: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instanceReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instance_reference_ext: Option<FieldExtension>,
    /** **Key of contained instance version**

 A reference to the key of a specific version of an instance in this instance.

 Required if the referenced instance has versions */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "versionReference")]
    pub version_reference: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_versionReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioInstanceContainedInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioInstanceContainedInstanceBuilder {
        ExampleScenarioInstanceContainedInstanceBuilder::default()
    }
}
/// Sub-fields of the process field in ExampleScenario
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioProcessBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioProcess {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 procss**

 A short descriptive label the process to be used in tables or diagrams.

 */
    #[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>,
    /** **Human-friendly description of the process**

 An explanation of what the process represents and what it does.

 */
    #[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>,
    /** **Status before process starts**

 Description of the initial state of the actors, environment and data before the process starts.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preConditions")]
    pub pre_conditions: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preConditions")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_conditions_ext: Option<FieldExtension>,
    /** **Status after successful completion**

 Description of the final state of the actors, environment and data after the process has been successfully completed.

 Alternate steps might not result in all post conditions holding */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "postConditions")]
    pub post_conditions: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_postConditions")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub post_conditions_ext: Option<FieldExtension>,
    /** **Event within of the process**

 A significant action that occurs as part of the process.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "step")]
    pub step: Vec<Option<ExampleScenarioProcessStep>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_step")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub step_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioProcess {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioProcessBuilder {
        ExampleScenarioProcessBuilder::default()
    }
}
/// Sub-fields of the step field in ExampleScenarioProcess
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioProcessStepBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioProcessStep {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Sequential number of the step**

 The sequential number of the step, e.g. 1.2.5.

 If step numbers are simultaneous, they will be the same.  Numbers don't have to be numeric.  E.g. '2c)' is a valid step number */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Option<String>,
    /// 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>,
    /** **Step is nested process**

 Indicates that the step is a complex sub-process with its own steps.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "process")]
    pub process: Option<ExampleScenarioProcess>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_process")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub process_ext: Option<FieldExtension>,
    /** **Step is nested workflow**

 Indicates that the step is defined by a seaparate scenario instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "workflow")]
    pub workflow: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_workflow")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub workflow_ext: Option<FieldExtension>,
    /** **Step is simple action**

 The step represents a single operation invoked on receiver by sender.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Option<ExampleScenarioProcessStepOperation>,
    /// 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>,
    /** **Alternate non-typical step action**

 Indicates an alternative step that can be taken instead of the sub-process, scenario or operation.  E.g. to represent non-happy-path/exceptional/atypical circumstances.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alternative")]
    pub alternative: Vec<Option<ExampleScenarioProcessStepAlternative>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_alternative")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub alternative_ext: Vec<Option<FieldExtension>>,
    /** **Pause in the flow?**

 If true, indicates that, following this step, there is a pause in the flow and the subsequent step will occur at some later time (triggered by some event).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pause")]
    pub pause: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_pause")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pause_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioProcessStep {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioProcessStepBuilder {
        ExampleScenarioProcessStepBuilder::default()
    }
}
/// Sub-fields of the operation field in ExampleScenarioProcessStep
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioProcessStepOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioProcessStepOperation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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://hl7.org/fhir/ValueSet/testscript-operation-codes); Kind of action**

 The standardized type of action (FHIR or otherwise).

 */
    #[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>,
    /** **Label for step**

 A short descriptive label the step to be used in tables or diagrams.

 */
    #[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>,
    /** **Who starts the operation**

 The system that invokes the action/transmits the data.

 This must either be the 'key' of one of the actors defined in this scenario or the special keyword 'OTHER' if the initiator is not one of the actors defined for the scenario.  (Multiple references to 'OTHER' don't necessarily indicate the same actor.) */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "initiator")]
    pub initiator: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_initiator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub initiator_ext: Option<FieldExtension>,
    /** **Who receives the operation**

 The system on which the action is invoked/receives the data.

 This must either be the 'key' of one of the actors defined in this scenario or the special keyword 'OTHER' if the receiver is not one of the actors defined for the scenario.  (Multiple references to 'OTHER' don't necessarily indicate the same actor.)  In some cases, receiver could be same as sender if representing a local operation */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receiver")]
    pub receiver: Option<String>,
    /// 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>,
    /** **Human-friendly description of the operation**

 An explanation of what the operation represents and what it does.

 This should contain information not already present in the process step.  It's more of a description of what the operation in general does - if not already evident from the operation.type */
    #[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>,
    /** **Initiator stays active?**

 If false, the initiator is deactivated right after the operation.

 De-activation of an actor means they have no further role until such time as they are the recipient of an operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "initiatorActive")]
    pub initiator_active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_initiatorActive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub initiator_active_ext: Option<FieldExtension>,
    /** **Receiver stays active?**

 If false, the receiver is deactivated right after the operation.

 De-activation of an actor means they have no further role until such time as they are the recipient of an operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receiverActive")]
    pub receiver_active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_receiverActive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub receiver_active_ext: Option<FieldExtension>,
    /** **Instance transmitted on invocation**

 A reference to the instance that is transmitted from requester to receiver as part of the invocation of the operation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<ExampleScenarioInstanceContainedInstance>,
    /// 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>,
    /** **Instance transmitted on invocation response**

 A reference to the instance that is transmitted from receiver to requester as part of the operation's synchronous response (if any).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<ExampleScenarioInstanceContainedInstance>,
    /// 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 ExampleScenarioProcessStepOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioProcessStepOperationBuilder {
        ExampleScenarioProcessStepOperationBuilder::default()
    }
}
/// Sub-fields of the alternative field in ExampleScenarioProcessStep
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExampleScenarioProcessStepAlternativeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExampleScenarioProcessStepAlternative {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 alternative**

 The label to display for the alternative that gives a sense of the circumstance in which the alternative should be invoked.

 */
    #[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>,
    /** **Human-readable description of option**

 A human-readable description of the alternative explaining when the alternative should occur rather than the base step.

 */
    #[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>,
    /** **Alternative action(s)**

 Indicates the operation, sub-process or scenario that happens if the alternative option is selected.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "step")]
    pub step: Vec<Option<ExampleScenarioProcessStep>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_step")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub step_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExampleScenarioProcessStepAlternative {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExampleScenarioProcessStepAlternativeBuilder {
        ExampleScenarioProcessStepAlternativeBuilder::default()
    }
}
/** 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.

 **[ExplanationOfBenefit](http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) v5.0.0**

 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>);
/** 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.

 **[ExplanationOfBenefit](http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 resource**

 A unique identifier assigned to this explanation of benefit.

 */
    #[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>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_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(rename = "status")]
    pub status: 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); Category or discipline**

 The category of claim, e.g. oral, pharmacy, vision, institutional, professional.

 The majority of jurisdictions use: oral, pharmacy, vision, professional and institutional, or variants on those terms, as the general styles of claims. The valueset is extensible to accommodate other jurisdictional requirements. */
    #[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>,
    /** **[ClaimSubType](http://hl7.org/fhir/ValueSet/claim-subtype); More granular claim type**

 A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.

 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 = "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>,
    /** **[Use](http://hl7.org/fhir/ValueSet/claim-use); claim | preauthorization | predetermination**

 A code to indicate whether the nature of the request is: Claim - A request to an Insurer to adjudicate the supplied charges for health care goods and services under the identified policy and to pay the determined Benefit amount, if any; Preauthorization - A request to an Insurer to adjudicate the supplied proposed future charges for health care goods and services under the identified policy and to approve the services and provide the expected benefit amounts and potentially to reserve funds to pay the benefits when Claims for the indicated services are later submitted; or, Pre-determination - A request to an Insurer to adjudicate the supplied 'what if' charges for health care goods and services under the identified policy and report back what the Benefit payable would be had the services actually been provided.

 */
    #[serde(rename = "use")]
    pub r#use: 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 recipient of the products and services**

 The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.

 */
    #[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>,
    /** **Relevant time frame for the claim**

 The period for which charges are being submitted.

 Typically this would be today or in the past for a claim, and today or in the future for preauthorizations and prodeterminations. Typically line item dates of service should fall within the billing period if one is specified. */
    #[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>,
    /** **Response creation date**

 The date this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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 of the claim**

 Individual who created the claim, predetermination or preauthorization.

 */
    #[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>,
    /** **Party responsible for reimbursement**

 The party responsible for authorization, adjudication and reimbursement.

 */
    #[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>,
    /** **Party responsible for the claim**

 The provider which is responsible for the claim, predetermination or preauthorization.

 Typically this field would be 1..1 where this party is accountable for the data content within the claim but is not necessarily the facility, provider group or practitioner who provided the products and services listed within this claim resource. This field is the Billing Provider, for example, a facility, provider group, lab or practitioner. */
    #[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>,
    /** **[ProcessPriority](http://hl7.org/fhir/ValueSet/process-priority); Desired processing urgency**

 The provider-required urgency of processing the request. Typical values include: stat, normal deferred.

 If a claim processor is unable to complete the processing as per the priority then they should generate an error and not process the request. */
    #[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); For whom to reserve funds**

 A code to indicate whether and for whom funds are to be reserved for future claims.

 This field is only used for preauthorizations. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fundsReserveRequested")]
    pub funds_reserve_requested: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fundsReserveRequested")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub funds_reserve_requested_ext: Option<FieldExtension>,
    /** **[FundsReserve](http://hl7.org/fhir/ValueSet/fundsreserve); Funds reserved status**

 A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.

 Fund would be release by a future claim quoting the preAuthRef of this response. Examples of values include: provider, patient, none. */
    #[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>,
    /** **Prior or corollary claims**

 Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.

 For example,  for the original treatment and follow-up exams. */
    #[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 is the document/authorization given to the claim author for them to provide products and services for which consideration (reimbursement) is sought. Could be a RX for medications, an 'order' for oxygen or wheelchair or physiotherapy treatments.

 */
    #[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 superseded 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 prescription for an alternate medication which has the same therapeutic 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>,
    /** **Event information**

 Information code for an event with a corresponding date or period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<ExplanationOfBenefitEvent>>,
    /// 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>>,
    /** **Recipient of benefits payable**

 The party to be reimbursed for cost of the products and services according to the terms of the policy.

 Often providers agree to receive the benefits payable to reduce the near-term costs to the patient. The insurer may decline to pay the provider and may choose to pay the subscriber instead. */
    #[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>,
    /** **Treatment Referral**

 The referral information received by the claim author, it is not to be used when the author generates a referral for a patient. A copy of that referral may be provided as supporting information. Some insurers require proof of referral to pay for services or to pay specialist rates for services.

 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>,
    /** **Encounters associated with the listed treatments**

 Healthcare encounters related to this claim.

 */
    #[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>>,
    /** **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 of the adjudication request: claim predetermination or preauthorization.

 */
    #[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 of the adjudication response: claim, predetermination or preauthorization response.

 */
    #[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>,
    /** **[ClaimOutcome](http://hl7.org/fhir/ValueSet/claim-outcome); queued | complete | error | partial**

 The outcome of the claim, predetermination, or preauthorization processing.

 The resource may be used to indicate that the Claim/Preauthorization/Pre-determination has been received but processing has not begun (queued); that it has been processed and one or more errors have been detected (error); no errors were detected and some of the adjudication processing has been performed (partial); or all of the adjudication processing has completed without errors (complete). */
    #[serde(rename = "outcome")]
    pub outcome: String,
    /// 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>,
    /** **[AdjudicationDecision](http://hl7.org/fhir/ValueSet/claim-decision); Result of the adjudication**

 The result of the claim, predetermination, or preauthorization adjudication.

 The element is used to indicate the current state of the adjudication overall for the claim resource, for example: the request has been held (pended) for adjudication processing, for manual review or other reasons; that it has been processed and will be paid, or the outstanding paid, as submitted (approved); that no amount will be paid (denied); or that some amount between zero and the submitted amoutn will be paid (partial). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A human readable 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>,
    /** **Preauthorization reference**

 Reference from the Insurer which is used in later communications which refers to this adjudication.

 This value is only present on preauthorization adjudications. */
    #[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>>,
    /** **Preauthorization in-effect period**

 The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.

 This value is only present on preauthorization adjudications. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRefPeriod")]
    pub pre_auth_ref_period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_preAuthRefPeriod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub pre_auth_ref_period_ext: Vec<Option<FieldExtension>>,
    /** **[DiagnosisRelatedGroup](http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup); Package billing code**

 A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.

 For example DRG (Diagnosis Related Group) or a bundled billing code. A patient may have a diagnosis of a Myocardial Infarction and a DRG for HeartAttack would be assigned. The Claim item (and possible subsequent claims) would refer to the DRG for those line items that were for services related to the heart attack event. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisRelatedGroup")]
    pub diagnosis_related_group: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diagnosisRelatedGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnosis_related_group_ext: Option<FieldExtension>,
    /** **Care Team members**

 The members of the team who provided the products and services.

 */
    #[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>>,
    /** **Supporting information**

 Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.

 Often there are multiple 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 = "supportingInfo")]
    pub supporting_info: Vec<Option<ExplanationOfBenefitSupportingInfo>>,
    /// 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>>,
    /** **Pertinent diagnosis information**

 Information about diagnoses relevant to the claim items.

 */
    #[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>>,
    /** **Clinical procedures performed**

 Procedures performed on the patient relevant to the billing items with the claim.

 */
    #[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.)**

 This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.

 */
    #[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>,
    /** **Patient insurance information**

 Financial instruments for reimbursement for the health care products and services specified on the claim.

 All insurance coverages for the patient which may be applicable for reimbursement, of the products and services listed in the claim, are typically provided in the claim to allow insurers to confirm the ordering of the insurance coverages relative to local 'coordination of benefit' rules. One coverage (and only one) with 'focal=true' is to be used in the adjudication of this claim. Coverages appearing before the focal Coverage in the list, and where 'Coverage.subrogation=false', should provide a reference to the ClaimResponse containing the adjudication results of the prior claim. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<ExplanationOfBenefitInsurance>>,
    /// 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 of the event**

 Details of a accident which resulted in injuries which required the products and services listed in the claim.

 */
    #[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>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: Option<FieldExtension>,
    /** **Product or service provided**

 A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.

 */
    #[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 product or service lines.

 */
    #[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>>,
    /** **Header-level adjudication**

 The adjudication results which are presented at the header level rather than at the line-item or add-item levels.

 */
    #[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>>,
    /** **Adjudication totals**

 Categorized monetary totals for the adjudication.

 Totals for amounts submitted, co-pays, benefits payable etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Vec<Option<ExplanationOfBenefitTotal>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub total_ext: Vec<Option<FieldExtension>>,
    /** **Payment Details**

 Payment details for the adjudication of the claim.

 */
    #[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**

 A code for the form to be used for printing the content.

 May be needed to identify specific jurisdictional forms. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "formCode")]
    pub form_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_formCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_code_ext: Option<FieldExtension>,
    /** **Printed reference or actual form**

 The actual form, by reference or inclusion, for printing the content or an EOB.

 Needed to permit insurers to include the actual form. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<Attachment>,
    /// 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>,
    /** **Note concerning adjudication**

 A note that describes or explains adjudication results in a human readable form.

 */
    #[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>>,
    /** **When the benefits are applicable**

 The term of the benefits documented in this response.

 Not applicable when use=claim. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitPeriod")]
    pub benefit_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_benefitPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub benefit_period_ext: 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Reference to a related claim.

 */
    #[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**

 A code to convey how the claims are related.

 For example, prior claim 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>,
    /** **File or case reference**

 An alternate organizational reference to the case or file to which this particular claim pertains.

 For example, Property/Casualty insurer claim number or Workers Compensation case number. */
    #[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 event 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 = "ExplanationOfBenefitEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitEvent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DatesType](http://hl7.org/fhir/ValueSet/datestype); Specific event**

 A coded event such as when a service is expected or a card printed.

 */
    #[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>,
    /** **Occurance date or period**

 A date or period in the past or future indicating when the event occurred or is expectd to occur.

 */
    #[serde(flatten)]
    pub when: ExplanationOfBenefitEventWhen,
    /// 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<ExplanationOfBenefitEventWhenExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitEventBuilder {
        ExplanationOfBenefitEventBuilder::default()
    }
}
/// Choice of types for the when[x] field in ExplanationOfBenefitEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitEventWhen {
    /// Variant accepting the DateTime type.
    #[serde(rename = "whenDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
}
/// Extension value for ExplanationOfBenefitEventWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitEventWhenExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_whenDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Category of recipient**

 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>,
    /** **Recipient reference**

 Reference to the individual or organization to whom any payment will be made.

 Not required if the payee is 'subscriber' or 'provider'. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Order of care team**

 A number to uniquely identify care team entries.

 */
    #[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>,
    /** **Practitioner or organization**

 Member of the team who provided the product or 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>,
    /** **Indicator of the lead practitioner**

 The party who is billing and/or responsible for the claimed products or services.

 Responsible might not be required when there is only a single provider listed. */
    #[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); Function within the team**

 The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.

 Role might not be required when there is only a single provider listed. */
    #[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); Practitioner or provider specialization**

 The specialization of the practitioner or provider 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 = "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>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitCareTeam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitCareTeamBuilder {
        ExplanationOfBenefitCareTeamBuilder::default()
    }
}
/// Sub-fields of the supportingInfo 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 = "ExplanationOfBenefitSupportingInfoBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitSupportingInfo {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 A number to uniquely identify supporting information entries.

 */
    #[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); Classification of the supplied information**

 The general class of the information supplied: information; exception; accident, employment; onset, etc.

 This may contain a category for the local bill type codes. */
    #[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.

 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<ExplanationOfBenefitSupportingInfoTiming>,
    /// 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<ExplanationOfBenefitSupportingInfoTimingExtension>,
    /** **Data to be provided**

 Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.

 Could be used to provide references to other resources, document. For example, could contain a PDF in an Attachment of the Police Report for an Accident. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ExplanationOfBenefitSupportingInfoValue>,
    /// 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<ExplanationOfBenefitSupportingInfoValueExtension>,
    /** **[MissingReason](http://hl7.org/fhir/ValueSet/missing-tooth-reason); Explanation for the information**

 Provides the reason in the situation where a reason code is required in addition to the content.

 For example: the reason for the additional stay, or why a tooth is  missing. */
    #[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 ExplanationOfBenefitSupportingInfo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitSupportingInfoBuilder {
        ExplanationOfBenefitSupportingInfoBuilder::default()
    }
}
/// Choice of types for the timing[x] field in ExplanationOfBenefitSupportingInfo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitSupportingInfoTiming {
    /// Variant accepting the Date type.
    #[serde(rename = "timingDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
}
/// Extension value for ExplanationOfBenefitSupportingInfoTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitSupportingInfoTimingExtension {
    /// 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 ExplanationOfBenefitSupportingInfo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitSupportingInfoValue {
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// 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),
    /// Variant accepting the Identifier type.
    #[serde(rename = "valueIdentifier")]
    Identifier(Identifier),
}
/// Extension value for ExplanationOfBenefitSupportingInfoValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitSupportingInfoValueExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// 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),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_valueIdentifier")]
    Identifier(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Diagnosis instance identifier**

 A number to uniquely identify diagnosis entries.

 Diagnosis are presented in list order to their expected importance: primary, secondary, etc. */
    #[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>,
    /** **Nature of illness or problem**

 The nature of illness or problem in a coded form or as a reference to an external defined Condition.

 */
    #[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**

 When the condition was observed or the relative ranking.

 For example: admitting, primary, secondary, discharge. */
    #[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>>,
    /** **[DiagnosisOnAdmission](http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission); Present on admission**

 Indication of whether the diagnosis was present on admission to a facility.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onAdmission")]
    pub on_admission: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onAdmission")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_admission_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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify procedure entries.

 */
    #[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>,
    /** **[ProcedureType](http://hl7.org/fhir/ValueSet/ex-procedure-type); Category of Procedure**

 When the condition was observed or the relative ranking.

 */
    #[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>>,
    /** **When the procedure was performed**

 Date and optionally time the procedure was performed.

 */
    #[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>,
    /** **Specific clinical procedure**

 The code or reference to a Procedure resource which identifies the clinical intervention performed.

 */
    #[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>,
    /** **Unique device identifier**

 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Coverage to be used for adjudication**

 A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.

 A patient may (will) have multiple insurance policies which provide reimbursement for healthcare services and products. For example, a person may also be covered by their spouse's policy and both appear in the list (and may be from the same insurer). This flag will be set to true for only one of the listed policies and that policy will be used for adjudicating this claim. Other claims would be created to request adjudication against the other listed policies. */
    #[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 insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.

 */
    #[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>,
    /** **Prior authorization reference number**

 Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.

 This value is an alphanumeric string that may be provided over the phone, via text, via paper, or within a ClaimResponse resource and is not a FHIR Identifier. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 incident occurred**

 Date of an accident event  related to the products and services contained in the claim.

 The date of the accident has to precede the dates of the products and services but within a reasonable timeframe. */
    #[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://terminology.hl7.org/ValueSet/v3-ActIncidentCode); The nature of the accident**

 The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.

 */
    #[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 event occurred**

 The physical location of the accident event.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 instance identifier**

 A number to uniquely identify item entries.

 */
    #[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 care team members**

 Care team members related to this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeamSequence")]
    pub care_team_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeamSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable diagnoses**

 Diagnoses applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisSequence")]
    pub diagnosis_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosisSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable procedures**

 Procedures applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureSequence")]
    pub procedure_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Applicable exception and supporting information**

 Exceptions, special conditions and supporting information applicable for this service or product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSequence")]
    pub information_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **Request or Referral for Service**

 Request or Referral for Goods or Service to be rendered.

 */
    #[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>>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Product or service billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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 or product delivery**

 The date or dates when the service or product was supplied, 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 or where product was supplied**

 Where the product or 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>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the line item. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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>>,
    /** **Anatomical location**

 Physical location where the service is performed or applies.

 */
    #[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<ExplanationOfBenefitItemBodySite>>,
    /// 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>>,
    /** **Encounters associated with the listed treatments**

 Healthcare encounters related to this claim.

 */
    #[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>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Adjudication details**

 If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.

 */
    #[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 bodySite 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 = "ExplanationOfBenefitItemBodySiteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItemBodySite {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[OralSites](http://hl7.org/fhir/ValueSet/tooth); Location**

 Physical service site on the patient (limb, tooth, etc.).

 For example: Providing a tooth code, allows an insurer to identify a provider performing a filling on a tooth that was previously removed. */
    #[serde(rename = "site")]
    pub site: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Sub-location**

 A region or surface of the bodySite, e.g. 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>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItemBodySite {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemBodySiteBuilder {
        ExplanationOfBenefitItemBodySiteBuilder::default()
    }
}
/// Sub-fields of the reviewOutcome 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 = "ExplanationOfBenefitItemReviewOutcomeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItemReviewOutcome {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[AdjudicationDecision](http://hl7.org/fhir/ValueSet/claim-decision); Result of the adjudication**

 The result of the claim, predetermination, or preauthorization adjudication.

 The element is used to indicate the current state of the adjudication overall for the claim resource, for example: the request has been held (pended) for adjudication processing, for manual review or other reasons; that it has been processed and will be paid, or the outstanding paid, as submitted (approved); that no amount will be paid (denied); or that some amount between zero and the submitted amount will be paid (partial). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decision")]
    pub decision: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_ext: Option<FieldExtension>,
    /** **[AdjudicationDecisionReason](http://hl7.org/fhir/ValueSet/claim-decision-reason); Reason for result of the adjudication**

 The reasons for the result of the claim, predetermination, or preauthorization adjudication.

 */
    #[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>>,
    /** **Preauthorization reference**

 Reference from the Insurer which is used in later communications which refers to this adjudication.

 This value is only present on preauthorization adjudications. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_ref_ext: Option<FieldExtension>,
    /** **Preauthorization reference effective period**

 The time frame during which this authorization is effective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthPeriod")]
    pub pre_auth_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAuthPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_auth_period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItemReviewOutcome {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemReviewOutcomeBuilder {
        ExplanationOfBenefitItemReviewOutcomeBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Type of adjudication information**

 A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.

 For example, codes 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**

 A code supporting the understanding of the adjudication result and explaining variance from expected amount.

 For example, may indicate that the funds for this benefit type have been exhausted. */
    #[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 category.

 For example, amount submitted, eligible amount, co-payment, and benefit payable. */
    #[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-monitary value**

 A non-monetary value associated with the category. Mutually exclusive to the amount element above.

 For example: eligible percentage or co-payment percentage. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Product or service provided**

 A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.

 */
    #[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>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include: Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the line item.detail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Detail level 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<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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Product or service provided**

 A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.

 */
    #[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>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in Oral whether the treatment is cosmetic or associated with TMJ, or for Medical whether the treatment was outside the clinic or outside 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the line item.detail.subDetail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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**

 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>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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 results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Subdetail level 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<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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Claim 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 = "itemSequence")]
    pub item_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_itemSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Detail sequence number**

 The sequence number of the details within the claim item which this line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detailSequence")]
    pub detail_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detailSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Subdetail sequence number**

 The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subDetailSequence")]
    pub sub_detail_sequence: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subDetailSequence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_detail_sequence_ext: Vec<Option<FieldExtension>>,
    /** **Number for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **Authorized providers**

 The providers who are authorized for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub provider_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **Request or Referral for Service**

 Request or Referral for Goods or Service to be rendered.

 */
    #[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>>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in 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 the product or service is provided under**

 Identifies the program under which this may be recovered.

 For example: Neonatal program, child dental program or drug users recovery 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 or product delivery**

 The date or dates when the service or product was supplied, 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<ExplanationOfBenefitAddItemServiced>,
    /// 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<ExplanationOfBenefitAddItemServicedExtension>,
    /** **Place of service or where product was supplied**

 Where the product or 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<ExplanationOfBenefitAddItemLocation>,
    /// 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<ExplanationOfBenefitAddItemLocationExtension>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the addItem. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Anatomical location**

 Physical location where the service is performed or applies.

 */
    #[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<ExplanationOfBenefitAddItemBodySite>>,
    /// 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>>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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>>,
    /** **Additem level adjudication results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items adjudication**

 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<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>>,
    /** **Insurer added line items**

 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()
    }
}
/// Choice of types for the serviced[x] field in ExplanationOfBenefitAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAddItemServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for ExplanationOfBenefitAddItemServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAddItemServicedExtension {
    /// 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 ExplanationOfBenefitAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAddItemLocation {
    /// 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 ExplanationOfBenefitAddItemLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAddItemLocationExtension {
    /// 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 bodySite 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 = "ExplanationOfBenefitAddItemBodySiteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitAddItemBodySite {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[OralSites](http://hl7.org/fhir/ValueSet/tooth); Location**

 Physical service site on the patient (limb, tooth, etc.).

 For example, providing a tooth code allows an insurer to identify a provider performing a filling on a tooth that was previously removed. */
    #[serde(rename = "site")]
    pub site: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Sub-location**

 A region or surface of the bodySite, e.g. 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>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitAddItemBodySite {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAddItemBodySiteBuilder {
        ExplanationOfBenefitAddItemBodySiteBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the group (if a grouper) or the addItem.detail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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>>,
    /** **Additem detail level adjudication results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items adjudication**

 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<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>>,
    /** **Insurer added line items**

 The third-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 = "subDetail")]
    pub sub_detail: Vec<Option<ExplanationOfBenefitAddItemDetailSubDetail>>,
    /// 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 ExplanationOfBenefitAddItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAddItemDetailBuilder {
        ExplanationOfBenefitAddItemDetailBuilder::default()
    }
}
/// Sub-fields of the subDetail field in ExplanationOfBenefitAddItemDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitAddItemDetailSubDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitAddItemDetailSubDetail {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for tracking**

 Trace number for tracking purposes. May be defined at the jurisdiction level or between trading partners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "traceNumber")]
    pub trace_number: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_traceNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trace_number_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of revenue 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>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing, service, product, or drug code**

 When the value is a group code then this item collects a set of related item details, otherwise this contains the product, service, drug or other billing code for the item. This element may be the start of a range of .productOrService codes used in conjunction with .productOrServiceEnd or it may be a solo element where .productOrServiceEnd is not used.

 If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. 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 e.g. 'glasses' or 'compound'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrService")]
    pub product_or_service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrService")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); End of a range of codes**

 This contains the end of a range of product, service, drug or other billing codes for the item. This element is not used when the .productOrService is a group code. This value may only be present when a .productOfService code has been provided to convey the start of the range. Typically this value may be used only with preauthorizations and not with claims.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productOrServiceEnd")]
    pub product_or_service_end: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productOrServiceEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_or_service_end_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes to convey additional context for the product or service.

 For example, in 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>>,
    /** **Paid by the patient**

 The amount paid by the patient, in total at the claim claim level or specifically for the item and detail level, to the provider for goods and services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPaid")]
    pub patient_paid: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patientPaid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_paid_ext: 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 item**

 If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details 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.

 To show a 10% senior's discount, the value entered is: 0.90 (1.00 - 0.10). */
    #[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 tax**

 The total of taxes applicable for this product or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tax")]
    pub tax: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tax")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tax_ext: Option<FieldExtension>,
    /** **Total item cost**

 The total amount claimed for the addItem.detail.subDetail. Net = unit price * quantity * factor.

 For example, the formula: quantity * unitPrice * factor  = net. Quantity and factor 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>,
    /** **Applicable note numbers**

 The numbers associated with notes below which apply to the adjudication of this item.

 */
    #[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>>,
    /** **Additem subdetail level adjudication results**

 The high-level results of the adjudication if adjudication has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewOutcome")]
    pub review_outcome: Option<ExplanationOfBenefitItemReviewOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reviewOutcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub review_outcome_ext: Option<FieldExtension>,
    /** **Added items adjudication**

 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<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 ExplanationOfBenefitAddItemDetailSubDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAddItemDetailSubDetailBuilder {
        ExplanationOfBenefitAddItemDetailSubDetailBuilder::default()
    }
}
/// Sub-fields of the total 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 = "ExplanationOfBenefitTotalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitTotal {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Type of adjudication information**

 A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.

 For example, codes 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>,
    /** **Financial total for the category**

 Monetary total amount associated with the category.

 */
    #[serde(rename = "amount")]
    pub amount: 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 ExplanationOfBenefitTotal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitTotalBuilder {
        ExplanationOfBenefitTotalBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 payment**

 Whether this represents partial or complete payment of the benefits payable.

 */
    #[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**

 Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.

 Insurers will deduct amounts owing from the provider (adjustment), such as a prior overpayment, from the amount owing to the provider (benefits payable) when payment is made to the provider. */
    #[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 variance**

 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 date the payment will be issued or the actual issue date of payment.

 */
    #[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**

 Benefits 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>,
    /** **Business identifier for the payment**

 Issuer's unique identifier for the payment instrument.

 For example: EFT number or check number. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Note instance identifier**

 A number to uniquely identify a note entry.

 */
    #[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); Note purpose**

 The business purpose of the note text.

 */
    #[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 explanation or description associated with the processing.

 */
    #[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/all-languages); Language of the text**

 A code to define the language used in the text of the note.

 Only required if the language is different from the resource language. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/ex-benefitcategory); Benefit classification**

 Code to identify the general type of benefits under which products and services are provided.

 Examples include Medical Care, Periodontics, Renal Dialysis, Vision Coverage. */
    #[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>,
    /** **Excluded from the plan**

 True if the indicated class of service is excluded from the plan, missing or False indicates the product or 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 or services covered.

 For example, 'DENT2 covers 100% of basic, 50% of major but excludes Ortho, Implants and Cosmetic 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**

 Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.

 */
    #[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**

 Indicates if the benefits apply to an individual or to the 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 visits'.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Benefit classification**

 Classification of benefit being provided.

 For example: deductible, 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**

 The quantity of the benefit which is permitted under the coverage.

 */
    #[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**

 The quantity of the benefit which have been consumed to date.

 */
    #[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),
}
/** Significant health conditions for a person related to the patient relevant in the context of care for the patient.

 **[FamilyMemberHistory](http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) v5.0.0**

 Information about patient's relatives, relevant for patient

 Significant health 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>);
/** Significant health conditions for a person related to the patient relevant in the context of care for the patient.

 **[FamilyMemberHistory](http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) v5.0.0**

 Information about patient's relatives, relevant for patient

 Significant health 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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>,
    /** **[FamilyHistoryAbsentReason](http://hl7.org/fhir/ValueSet/history-absent-reason); subject-unknown | withheld | unable-to-obtain | deferred**

 Describes why the family member's history is not available.

 */
    #[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>,
    /** **Patient history is about**

 The person who this history concerns.

 This is not the family member. */
    #[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 recorded or last updated**

 The date (and possibly time) when the family member history was recorded or last updated.

 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>,
    /** **Who or what participated in the activities related to the family member history and how they were involved**

 Indicates who or what participated in the activities related to the family member history and how they were involved.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<FamilyMemberHistoryParticipant>>,
    /// 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 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://terminology.hl7.org/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>,
    /** **[Sex](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 The birth sex of the family member.

 This element should ideally reflect whether the individual is genetically male or female.  However, as reported information based on the knowledge of the patient or reporting friend/relative, there may be situations where the reported sex might not be totally accurate.  E.g. 'Aunt Sue' might be XY rather than XX.  Questions soliciting this information should be phrased to encourage capture of genetic sex where known.  However, systems performing analysis should also allow for the possibility of imprecision with this element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sex")]
    pub sex: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sex")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sex_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 that 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, or Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.

 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<CodeableReference>>,
    /// 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>>,
    /** **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.

 */
    #[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>>,
    /** **Procedures that the related person had**

 The significant Procedures (or procedure) that the family member had. This is a repeating section to allow a system to represent more than one procedure per resource, though there is nothing stopping multiple resources - one per procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Vec<Option<FamilyMemberHistoryProcedure>>,
    /// 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>>,
}
#[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
    }
}
/// Sub-fields of the participant 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 = "FamilyMemberHistoryParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct FamilyMemberHistoryParticipant {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FamilyMemberHistoryParticipantFunction](http://hl7.org/fhir/ValueSet/participation-role-type); Type of involvement**

 Distinguishes the type of involvement of the actor in the activities related to the family member history.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who or what participated in the activities related to the family member history**

 Indicates who or what participated in the activities related to the family member history.

 */
    #[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 FamilyMemberHistoryParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> FamilyMemberHistoryParticipantBuilder {
        FamilyMemberHistoryParticipantBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 following the 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>,
    /** **Whether the condition contributed to the cause of death**

 This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributedToDeath")]
    pub contributed_to_death: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contributedToDeath")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contributed_to_death_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),
}
/// Sub-fields of the procedure 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 = "FamilyMemberHistoryProcedureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct FamilyMemberHistoryProcedure {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProcedureCode](http://hl7.org/fhir/ValueSet/procedure-code); Procedures performed on the related person**

 The actual procedure specified. Could be a coded procedure or a less specific string depending on how much is known about the procedure 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>,
    /** **[ProcedureOutcome](http://hl7.org/fhir/ValueSet/clinical-findings); What happened following the procedure**

 Indicates what happened following the procedure. If the procedure 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>,
    /** **Whether the procedure contributed to the cause of death**

 This procedure contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributedToDeath")]
    pub contributed_to_death: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contributedToDeath")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contributed_to_death_ext: Option<FieldExtension>,
    /** **When the procedure was performed**

 Estimated or actual date, date-time, period, or age when 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<FamilyMemberHistoryProcedurePerformed>,
    /// 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<FamilyMemberHistoryProcedurePerformedExtension>,
    /** **Extra information about the procedure**

 An area where general notes can be placed about this specific procedure.

 */
    #[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 FamilyMemberHistoryProcedure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> FamilyMemberHistoryProcedureBuilder {
        FamilyMemberHistoryProcedureBuilder::default()
    }
}
/// Choice of types for the performed[x] field in FamilyMemberHistoryProcedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryProcedurePerformed {
    /// Variant accepting the Age type.
    #[serde(rename = "performedAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "performedRange")]
    Range(Range),
    /// Variant accepting the Period type.
    #[serde(rename = "performedPeriod")]
    Period(Period),
    /// Variant accepting the String type.
    #[serde(rename = "performedString")]
    String(String),
    /// Variant accepting the DateTime type.
    #[serde(rename = "performedDateTime")]
    DateTime(DateTime),
}
/// Extension value for FamilyMemberHistoryProcedurePerformed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryProcedurePerformedExtension {
    /// Variant accepting the Age extension.
    #[serde(rename = "_performedAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_performedRange")]
    Range(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_performedPeriod")]
    Period(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_performedString")]
    String(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_performedDateTime")]
    DateTime(FieldExtension),
}
/** Prospective warnings of potential issues when providing care to the patient.

 **[Flag](http://hl7.org/fhir/StructureDefinition/Flag) v5.0.0**

 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>);
/** Prospective warnings of potential issues when providing care to the patient.

 **[Flag](http://hl7.org/fhir/StructureDefinition/Flag) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[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 a 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.

 The value set will often need to be adjusted based on local business rules and usage context. */
    #[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>>,
    /** **[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, related person, 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
    }
}
/** This resource describes a product or service that is available through a program and includes the conditions and constraints of availability.  All of the information in this resource is specific to the inclusion of the item in the formulary and is not inherent to the item itself.

 **[FormularyItem](http://hl7.org/fhir/StructureDefinition/FormularyItem) v5.0.0**

 Definition of a FormularyItem

 This resource describes a product or service that is available through a program and includes the conditions and constraints of availability.  All of the information in this resource is specific to the inclusion of the item in the formulary and is not inherent to the item itself.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct FormularyItem(pub Box<FormularyItemInner>);
/** This resource describes a product or service that is available through a program and includes the conditions and constraints of availability.  All of the information in this resource is specific to the inclusion of the item in the formulary and is not inherent to the item itself.

 **[FormularyItem](http://hl7.org/fhir/StructureDefinition/FormularyItem) v5.0.0**

 Definition of a FormularyItem

 This resource describes a product or service that is available through a program and includes the conditions and constraints of availability.  All of the information in this resource is specific to the inclusion of the item in the formulary and is not inherent to the item itself.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "FormularyItemBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct FormularyItemInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "FormularyItem::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::FormularyItem", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this formulary item**

 Business identifier for this formulary 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>>,
    /** **[FormularyItemFormalRepresentation](http://hl7.org/fhir/ValueSet/medication-codes); Codes that identify this formulary item**

 A code (or set of codes) that specify the product or service that is identified by this formulary item.

 */
    #[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>,
    /** **[FormularyItemStatus](http://hl7.org/fhir/ValueSet/formularyitem-status); active | entered-in-error | inactive**

 The validity about the information of the formulary item and not of the underlying product or service itself.

 This status is intended to identify if the formulary item in a local system is in active use within the formulary.  For example, a formulary might include a medicinal product and the status relates to its inclusion.  At some point in the future, if the status of the formulary item is changed to "inactive" that means that it is no longer valid in the formulary.  But the product itself might still be in active use and might be included in other formularies. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::FormularyItemStatusCodes>,
    /// 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 FormularyItemBuilder {
    #[doc = concat!("Finalize building ", "FormularyItem", ".")]
    pub fn build(self) -> Result<FormularyItem, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<FormularyItemInner> for FormularyItem {
    fn from(inner: FormularyItemInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for FormularyItem {
    type Target = FormularyItemInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for FormularyItem {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl FormularyItem {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> FormularyItemBuilder {
        FormularyItemBuilder::default()
    }
}
impl FormularyItem {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::FormularyItem
    }
}
/** A set of analyses performed to analyze and generate genomic data.

 **[GenomicStudy](http://hl7.org/fhir/StructureDefinition/GenomicStudy) v5.0.0**

 Genomic Study

 A GenomicStudy is a set of analyses performed to analyze and generate genomic data.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct GenomicStudy(pub Box<GenomicStudyInner>);
/** A set of analyses performed to analyze and generate genomic data.

 **[GenomicStudy](http://hl7.org/fhir/StructureDefinition/GenomicStudy) v5.0.0**

 Genomic Study

 A GenomicStudy is a set of analyses performed to analyze and generate genomic 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 = "GenomicStudyBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct GenomicStudyInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "GenomicStudy::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::GenomicStudy", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for this genomic study**

 Identifiers for this genomic 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>>,
    /** **[GenomicStudyStatus](http://hl7.org/fhir/ValueSet/genomicstudy-status); registered | available | cancelled | entered-in-error | unknown**

 The status of the genomic study.

 */
    #[serde(rename = "status")]
    pub status: codes::GenomicStudyStatus,
    /// 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>,
    /** **[GenomicStudyType](http://hl7.org/fhir/ValueSet/genomicstudy-type); The type of the study (e.g., Familial variant segregation, Functional variation detection, or Gene expression profiling)**

 The type of the study, e.g., Familial variant segregation, Functional variation detection, or Gene expression profiling.

 */
    #[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 primary subject of the genomic study**

 The primary subject of the genomic study.

 */
    #[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 healthcare event with which this genomics study is associated**

 The healthcare event with which this genomics study is associated.

 */
    #[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 genomic study was started**

 When the genomic study was started.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "startDate")]
    pub start_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_startDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_date_ext: Option<FieldExtension>,
    /** **Event resources that the genomic study is based on**

 Event resources that the genomic study is based on.

 */
    #[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>>,
    /** **Healthcare professional who requested or referred the genomic study**

 Healthcare professional who requested or referred the genomic study.

 */
    #[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>,
    /** **Healthcare professionals who interpreted the genomic study**

 Healthcare professionals who interpreted the genomic study.

 */
    #[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>>,
    /** **Why the genomic study was performed**

 Why the genomic study was performed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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 defined protocol that describes the study**

 The defined protocol that describes the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_canonical_ext: Option<FieldExtension>,
    /** **The URL pointing to an externally maintained protocol that describes the study**

 The URL pointing to an externally maintained protocol that describes the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_uri_ext: Option<FieldExtension>,
    /** **Comments related to the genomic study**

 Comments related to the genomic study.

 */
    #[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>>,
    /** **Description of the genomic study**

 Description of the genomic study.

 */
    #[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>,
    /** **Genomic Analysis Event**

 The details about a specific analysis that was performed in this GenomicStudy.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "analysis")]
    pub analysis: Vec<Option<GenomicStudyAnalysis>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_analysis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub analysis_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GenomicStudyBuilder {
    #[doc = concat!("Finalize building ", "GenomicStudy", ".")]
    pub fn build(self) -> Result<GenomicStudy, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<GenomicStudyInner> for GenomicStudy {
    fn from(inner: GenomicStudyInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for GenomicStudy {
    type Target = GenomicStudyInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for GenomicStudy {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl GenomicStudy {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> GenomicStudyBuilder {
        GenomicStudyBuilder::default()
    }
}
impl GenomicStudy {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::GenomicStudy
    }
}
/// Sub-fields of the analysis field in GenomicStudy
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GenomicStudyAnalysisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GenomicStudyAnalysis {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for the analysis event**

 Identifiers for the analysis event.

 */
    #[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>>,
    /** **[GenomicStudyMethodType](http://hl7.org/fhir/ValueSet/genomicstudy-methodtype); Type of the methods used in the analysis (e.g., FISH, Karyotyping, MSI)**

 Type of the methods used in the analysis, e.g., Fluorescence in situ hybridization (FISH), Karyotyping, or Microsatellite instability testing (MSI).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "methodType")]
    pub method_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_methodType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub method_type_ext: Vec<Option<FieldExtension>>,
    /** **[GenomicStudyChangeType](http://hl7.org/fhir/ValueSet/genomicstudy-changetype); Type of the genomic changes studied in the analysis (e.g., DNA, RNA, or AA change)**

 Type of the genomic changes studied in the analysis, e.g., DNA, RNA, or amino acid change.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "changeType")]
    pub change_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_changeType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub change_type_ext: Vec<Option<FieldExtension>>,
    /** **[HumanRefSeqNCBIBuildId](http://loinc.org/vs/LL1040-6); Genome build that is used in this analysis**

 The reference genome build that is used in this analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genomeBuild")]
    pub genome_build: Option<CodeableConcept>,
    /// 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>,
    /** **The defined protocol that describes the analysis**

 The defined protocol that describes the analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_canonical_ext: Option<FieldExtension>,
    /** **The URL pointing to an externally maintained protocol that describes the analysis**

 The URL pointing to an externally maintained protocol that describes the analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_uri_ext: Option<FieldExtension>,
    /** **Name of the analysis event (human friendly)**

 Name of the analysis event (human friendly).

 */
    #[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>,
    /** **What the genomic analysis is about, when it is not about the subject of record**

 The focus of a genomic analysis when it is not the patient of record representing something or someone associated with the patient such as a spouse, parent, child, or sibling. For example, in trio testing, the GenomicStudy.subject would be the child (proband) and the GenomicStudy.analysis.focus of a specific analysis would be the parent.

 If the focus of the analysis is not known, the value of this field SHALL use the data absent extension. */
    #[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>>,
    /** **The specimen used in the analysis event**

 The specimen used in the analysis event.

 */
    #[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>>,
    /** **The date of the analysis event**

 The date of the analysis event.

 */
    #[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>,
    /** **Any notes capture with the analysis event**

 Any notes capture with the analysis event.

 */
    #[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>>,
    /** **The protocol that was performed for the analysis event**

 The protocol that was performed for the analysis event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protocolPerformed")]
    pub protocol_performed: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_protocolPerformed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub protocol_performed_ext: Option<FieldExtension>,
    /** **The genomic regions to be studied in the analysis (BED file)**

 The genomic regions to be studied in the analysis (BED file).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regionsStudied")]
    pub regions_studied: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_regionsStudied")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub regions_studied_ext: Vec<Option<FieldExtension>>,
    /** **Genomic regions actually called in the analysis event (BED file)**

 Genomic regions actually called in the analysis event (BED file).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regionsCalled")]
    pub regions_called: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_regionsCalled")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub regions_called_ext: Vec<Option<FieldExtension>>,
    /** **Inputs for the analysis event**

 Inputs for the analysis event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "input")]
    pub input: Vec<Option<GenomicStudyAnalysisInput>>,
    /// 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>>,
    /** **Outputs for the analysis event**

 Outputs for the analysis event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "output")]
    pub output: Vec<Option<GenomicStudyAnalysisOutput>>,
    /// 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>>,
    /** **Performer for the analysis event**

 Performer for the analysis event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<GenomicStudyAnalysisPerformer>>,
    /// 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>>,
    /** **Devices used for the analysis (e.g., instruments, software), with settings and parameters**

 Devices used for the analysis (e.g., instruments, software), with settings and parameters.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Vec<Option<GenomicStudyAnalysisDevice>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl GenomicStudyAnalysis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GenomicStudyAnalysisBuilder {
        GenomicStudyAnalysisBuilder::default()
    }
}
/// Sub-fields of the input field in GenomicStudyAnalysis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GenomicStudyAnalysisInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GenomicStudyAnalysisInput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **File containing input data**

 File containing input data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "file")]
    pub file: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_file")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub file_ext: Option<FieldExtension>,
    /** **[GenomicStudyDataFormat](http://hl7.org/fhir/ValueSet/genomicstudy-dataformat); Type of input data (e.g., BAM, CRAM, or FASTA)**

 Type of input data, e.g., BAM, CRAM, or FASTA.

 */
    #[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 analysis event or other GenomicStudy that generated this input file**

 The analysis event or other GenomicStudy that generated this input file.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub generated_by: Option<GenomicStudyAnalysisInputGeneratedBy>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub generated_by_ext: Option<GenomicStudyAnalysisInputGeneratedByExtension>,
}
#[cfg(feature = "builders")]
impl GenomicStudyAnalysisInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GenomicStudyAnalysisInputBuilder {
        GenomicStudyAnalysisInputBuilder::default()
    }
}
/// Choice of types for the generatedBy[x] field in GenomicStudyAnalysisInput
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GenomicStudyAnalysisInputGeneratedBy {
    /// Variant accepting the Identifier type.
    #[serde(rename = "generatedByIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Reference type.
    #[serde(rename = "generatedByReference")]
    Reference(Reference),
}
/// Extension value for GenomicStudyAnalysisInputGeneratedBy.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GenomicStudyAnalysisInputGeneratedByExtension {
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_generatedByIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_generatedByReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the output field in GenomicStudyAnalysis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GenomicStudyAnalysisOutputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GenomicStudyAnalysisOutput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **File containing output data**

 File containing output data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "file")]
    pub file: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_file")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub file_ext: Option<FieldExtension>,
    /** **[GenomicStudyDataFormat](http://hl7.org/fhir/ValueSet/genomicstudy-dataformat); Type of output data (e.g., VCF, MAF, or BAM)**

 Type of output data, e.g., VCF, MAF, or BAM.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl GenomicStudyAnalysisOutput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GenomicStudyAnalysisOutputBuilder {
        GenomicStudyAnalysisOutputBuilder::default()
    }
}
/// Sub-fields of the performer field in GenomicStudyAnalysis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GenomicStudyAnalysisPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GenomicStudyAnalysisPerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 organization, healthcare professional, or others who participated in performing this analysis**

 The organization, healthcare professional, or others who participated in performing this analysis.

 */
    #[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>,
    /** **Role of the actor for this analysis**

 Role of the actor for this analysis.

 */
    #[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 GenomicStudyAnalysisPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GenomicStudyAnalysisPerformerBuilder {
        GenomicStudyAnalysisPerformerBuilder::default()
    }
}
/// Sub-fields of the device field in GenomicStudyAnalysis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GenomicStudyAnalysisDeviceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GenomicStudyAnalysisDevice {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Device used for the analysis**

 Device used for the analysis.

 */
    #[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>,
    /** **Specific function for the device used for the analysis**

 Specific function for the device used for the analysis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl GenomicStudyAnalysisDevice {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GenomicStudyAnalysisDeviceBuilder {
        GenomicStudyAnalysisDeviceBuilder::default()
    }
}
/** 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](http://hl7.org/fhir/StructureDefinition/Goal) v5.0.0**

 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>);
/** 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](http://hl7.org/fhir/StructureDefinition/Goal) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this goal by the performer or other systems which remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **[GoalLifecycleStatus](http://hl7.org/fhir/ValueSet/goal-status); proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected**

 The state of the goal throughout its lifecycle.

 This element is labeled as a modifier because the lifecycleStatus contains codes that mark the resource as not currently valid. */
    #[serde(rename = "lifecycleStatus")]
    pub lifecycle_status: codes::GoalLifecycleStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lifecycleStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub lifecycle_status_ext: Option<FieldExtension>,
    /** **[GoalAchievementStatus](http://hl7.org/fhir/ValueSet/goal-achievement); in-progress | improving | worsening | no-change | achieved | sustaining | not-achieved | no-progress | not-attainable**

 Describes the progression, or lack thereof, towards the goal against the target.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "achievementStatus")]
    pub achievement_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_achievementStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub achievement_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>>,
    /** **After meeting the goal, ongoing activity is needed to sustain the goal objective**

 After meeting the goal, ongoing activity is needed to sustain the goal objective.

 For example, getting a yellow fever vaccination for a planned trip is a goal that is designed to be completed (continuous = false).  A goal to sustain HbA1c levels would not be a one-time goal (continuous = true). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "continuous")]
    pub continuous: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_continuous")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub continuous_ext: 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(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>,
    /** **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.

 When multiple targets are present for a single goal instance, all targets must be met for the overall goal to be met. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<GoalTarget>>,
    /// 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 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 or team responsible 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 = "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>,
    /** **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; 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 = "outcome")]
    pub outcome: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 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 Goal.target.measure defines a coded 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),
    /// Variant accepting the String type.
    #[serde(rename = "detailString")]
    String(String),
    /// Variant accepting the Boolean type.
    #[serde(rename = "detailBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "detailInteger")]
    Integer(i32),
    /// Variant accepting the Ratio type.
    #[serde(rename = "detailRatio")]
    Ratio(Ratio),
}
/// 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),
    /// Variant accepting the String extension.
    #[serde(rename = "_detailString")]
    String(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_detailBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_detailInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_detailRatio")]
    Ratio(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),
}
/** 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.

 **[GraphDefinition](http://hl7.org/fhir/StructureDefinition/GraphDefinition) v5.0.0**

 Definition of a 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>);
/** 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.

 **[GraphDefinition](http://hl7.org/fhir/StructureDefinition/GraphDefinition) v5.0.0**

 Definition of a 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this graph definition, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 GraphDefinition (business identifier)**

 A formal identifier that is used to identify this GraphDefinition when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **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 reference to a particular business version of the graph definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<GraphDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<GraphDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 graph definition (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 graph definition. Enables tracking the life-cycle of the content.

 Allows filtering of graph definitions that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the graph definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 graph definition is presumed to be the predominant language in the place the graph definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the graph definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the graph 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Starting Node**

 The Node at which instances of this graph start. If there is no nominated start, the graph can start at any of the nodes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<String>,
    /// 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>,
    /** **Potential target for the link**

 Potential target for the link.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "node")]
    pub node: Vec<Option<GraphDefinitionNode>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_node")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub node_ext: Vec<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
    }
}
/// Choice of types for the versionAlgorithm[x] field in GraphDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GraphDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for GraphDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GraphDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the node 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 = "GraphDefinitionNodeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GraphDefinitionNode {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 - target for link references**

 Internal ID of node - target for link references.

 */
    #[serde(rename = "nodeId")]
    pub node_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nodeId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub node_id_ext: Option<FieldExtension>,
    /** **Why this node is specified**

 Information about why this node 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/version-independent-all-resource-types); Type of resource this link refers to**

 Type of resource this link refers to.

 */
    #[serde(rename = "type")]
    pub r#type: codes::FHIRTypes,
    /// 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>,
}
#[cfg(feature = "builders")]
impl GraphDefinitionNode {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionNodeBuilder {
        GraphDefinitionNodeBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **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>,
    /** **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>,
    /** **Source Node for this link**

 The source node for this link.

 */
    #[serde(rename = "sourceId")]
    pub source_id: 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>,
    /** **Path in the resource that contains the link**

 A FHIRPath expression that identifies one of FHIR References to other resources.

 The path expression cannot contain a resolve() function. If there is no path, the link is a reverse lookup, using target.params. If the path is "*" then this means all references in the resource. */
    #[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>,
    /** **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>,
    /** **Target Node for this link**

 The target node for this link.

 */
    #[serde(rename = "targetId")]
    pub target_id: 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>,
    /** **Criteria for reverse lookup**

 A set of parameters to look up.

 At least one of the parameters must have the value {ref} which identifies the focus resource. */
    #[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>,
    /** **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<GraphDefinitionLinkCompartment>>,
    /// 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 GraphDefinitionLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionLinkBuilder {
        GraphDefinitionLinkBuilder::default()
    }
}
/// Sub-fields of the compartment 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 = "GraphDefinitionLinkCompartmentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GraphDefinitionLinkCompartment {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GraphCompartmentUse](http://hl7.org/fhir/ValueSet/graph-compartment-use); where | requires**

 Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.

 All conditional rules are evaluated; if they are true, then the rules are evaluated. */
    #[serde(rename = "use")]
    pub r#use: codes::GraphCompartmentUse,
    /// 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>,
    /** **[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>,
    /** **[CompartmentCode](http://hl7.org/fhir/ValueSet/compartment-type); Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare**

 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>,
    /** **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 GraphDefinitionLinkCompartment {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionLinkCompartmentBuilder {
        GraphDefinitionLinkCompartmentBuilder::default()
    }
}
/** 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.

 **[Group](http://hl7.org/fhir/StructureDefinition/Group) v5.0.0**

 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.

 If both Group.characteristic and Group.member are present, then the members are the individuals who were found who met the characteristic.  It's possible that there might be other candidate members who meet the characteristic and aren't (yet) in the list.  All members SHALL have the listed characteristics. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Group(pub Box<GroupInner>);
/** 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.

 **[Group](http://hl7.org/fhir/StructureDefinition/Group) v5.0.0**

 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.

 If both Group.characteristic and Group.member are present, then the members are the individuals who were found who met the characteristic.  It's possible that there might be other candidate members who meet the characteristic and aren't (yet) in the list.  All members SHALL have the listed characteristics. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this Group**

 Business identifiers assigned to this participant by one of the applications involved.  These identifiers remain constant as the resource is updated and propagates from server to server.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types. */
    #[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 | careteam | healthcareservice | location | organization | relatedperson | specimen**

 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, PractitionerRole, Device, CareTeam, HealthcareService, Location, Organization, RelatedPerson, or Specimen for the other types.), or a Group of the resources of the appropriate type. */
    #[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>,
    /** **[](http://hl7.org/fhir/ValueSet/group-membership-basis); definitional | enumerated**

 Basis for membership in the Group:

* 'definitional': The Group.characteristics specified are both necessary and sufficient to determine membership. All entities that meet the criteria are considered to be members of the group, whether referenced by the group or not. If members are present, they are individuals that happen to be known as meeting the Group.characteristics. The list cannot be presumed to be complete.
* 'enumerated': The Group.characteristics are necessary but not sufficient to determine membership. Membership is determined by being listed as one of the Group.member.

 */
    #[serde(rename = "membership")]
    pub membership: codes::GroupMembershipBasis,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_membership")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub membership_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>,
    /** **Natural language description of the group**

 Explanation of what the group represents and how it is intended to 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>,
    /** **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>,
    /** **Entity that is the custodian of the Group's definition**

 Entity responsible for defining and maintaining Group characteristics and/or registered members.

 This does not strictly align with ownership of a herd or flock, but may suffice to represent that relationship in simple cases. More complex cases will require an extension. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingEntity")]
    pub managing_entity: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingEntity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_entity_ext: Option<FieldExtension>,
    /** **Include / Exclude group members by Trait**

 Identifies traits whose presence r absence is 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// 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),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. If the entity is another group, then the type must be the same.

 */
    #[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()
    }
}
/** 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.

 **[GuidanceResponse](http://hl7.org/fhir/StructureDefinition/GuidanceResponse) v5.0.0**

 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>);
/** 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.

 **[GuidanceResponse](http://hl7.org/fhir/StructureDefinition/GuidanceResponse) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the request associated with this response, if any**

 The identifier of the request associated with this response. If an identifier 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 = "requestIdentifier")]
    pub request_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_identifier_ext: Option<FieldExtension>,
    /** **Business identifier**

 Allows a service to provide  unique, business identifiers for the response.

 */
    #[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 guidance was requested**

 An identifier, CodeableConcept or canonical reference to the guidance that was requested.

 */
    #[serde(flatten)]
    pub module: GuidanceResponseModule,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub module_ext: Option<GuidanceResponseModuleExtension>,
    /** **[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 during which the response was returned**

 The encounter during which this response was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official copmletion of an encounter but still be tied to the context of the encounter. */
    #[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 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>,
    /** **Why guidance is needed**

 Describes the reason for the guidance response in coded or textual form, or 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.

 Although this reference can be used to point to any resource, it is typically expected to refer to subject-specific data appropriate to the subject of the guidance. For example, patient-based decision support would be expected to reference patient-level data. In addition, implementations should provide as much detail as possible by using the [http://hl7.org/fhir/StructureDefinition/targetElement](http://hl7.org/fhir/extensions/StructureDefinition-targetElement.html) and [http://hl7.org/fhir/StructureDefinition/targetPath](http://hl7.org/fhir/extensions/StructureDefinition-targetPath.html) extensions to indicate the specific elements relevant to providing the reason for the guidance. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **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 = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evaluationMessage")]
    pub evaluation_message: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_evaluationMessage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub evaluation_message_ext: 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 = "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>>,
    /** **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 module[x] field in GuidanceResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GuidanceResponseModule {
    /// Variant accepting the Uri type.
    #[serde(rename = "moduleUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "moduleCanonical")]
    Canonical(String),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "moduleCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for GuidanceResponseModule.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GuidanceResponseModuleExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_moduleUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_moduleCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_moduleCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** The details of a healthcare service available at a location or in a catalog.  In the case where there is a hierarchy of services (for example, Lab -> Pathology -> Wound Cultures), this can be represented using a set of linked HealthcareServices.

 **[HealthcareService](http://hl7.org/fhir/StructureDefinition/HealthcareService) v5.0.0**

 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>);
/** The details of a healthcare service available at a location or in a catalog.  In the case where there is a hierarchy of services (for example, Lab -> Pathology -> Wound Cultures), this can be represented using a set of linked HealthcareServices.

 **[HealthcareService](http://hl7.org/fhir/StructureDefinition/HealthcareService) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 record is in active use**

 This flag is used to mark the record to not be used. This is not used when a center is closed for maintenance, or for holidays, the notAvailable period is to be used for this.

 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>,
    /** **The service within which this service is offered**

 When the HealthcareService is representing a specific, schedulable service, the availableIn property can refer to a generic service.

 For example, if there is a generic Radiology service that offers CT Scans, MRIs, etc.  You could have HealthcareService resources for the CT Scans and MRIs, which have an offeredIn reference to the Radiology HealthcareService. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "offeredIn")]
    pub offered_in: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_offeredIn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub offered_in_ext: Vec<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 = "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>>,
    /** **[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 Healthcare service. 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>,
    /** **Official contact details for the HealthcareService**

 The contact details of communication devices available relevant to the specific HealthcareService. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.

 The address/telecom use code 'home' are not to be used. Note that these contacts are not the contact details of people who provide the service (that would be through PractitionerRole), these are official contacts for the HealthcareService itself for specific purposes. E.g. Mailing Addresses, Billing Addresses, Contact numbers for Booking or Billing Enquiries, general web address, web address for online bookings etc.

If this is empty (or the type of interest is empty), 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 = "contact")]
    pub contact: Vec<Option<ExtendedContactDetail>>,
    /// 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>>,
    /** **Location(s) service is intended 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>>,
    /** **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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eligibility")]
    pub eligibility: Vec<Option<HealthcareServiceEligibility>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_eligibility")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub eligibility_ext: Vec<Option<FieldExtension>>,
    /** **[Program](http://hl7.org/fhir/ValueSet/program); Programs that this service is applicable to**

 Programs that this service is applicable to.

 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 = "program")]
    pub program: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_program")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_ext: Vec<Option<FieldExtension>>,
    /** **[ServiceCharacteristic](http://hl7.org/fhir/ValueSet/service-mode); 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>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/all-languages); The language that this service is offered in**

 Some services are specifically made available in multiple languages, this property permits a directory to declare the languages this is offered in. Typically this is only provided where a service operates in communities with mixed languages used.

 When using this property it indicates that the service is available with this language, it is not derived from the practitioners, and not all are required to use this language, just that this language is available while scheduling. */
    #[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>>,
    /** **[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 healthcare service is available (including exceptions)**

 A collection of times that the healthcare service is available.

 More detailed availability information may be provided in associated Schedule/Slot resources.

Systems may choose to render availability differently than it is exchanged on the interface. For example, rather than "Mon, Tue, Wed, Thur, Fri from 9am-12am; Mon, Tue, Wed, Thur, Fri from 1pm-5pm" as would be implied by two availableTime repetitions, an application could render this information as "Mon-Fri 9-12am and 1-5pm".

The NotAvailableTime(s) included indicate the general days/periods where the service is not available (for things such as public holidays). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availability")]
    pub availability: Vec<Option<Availability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_availability")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub availability_ext: Vec<Option<FieldExtension>>,
    /** **Technical endpoints providing access to electronic services operated for the healthcare service**

 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 eligibility 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 = "HealthcareServiceEligibilityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct HealthcareServiceEligibility {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ServiceEligibility](); Coded value for the eligibility**

 Coded value for the eligibility.

 */
    #[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>,
    /** **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 = "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 HealthcareServiceEligibility {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> HealthcareServiceEligibilityBuilder {
        HealthcareServiceEligibilityBuilder::default()
    }
}
/** A selection of DICOM SOP instances and/or frames within a single Study and Series. This might include additional specifics such as an image region, an Observation UID or a Segmentation Number, allowing linkage to an Observation Resource or transferring this information along with the ImagingStudy Resource.

 **[ImagingSelection](http://hl7.org/fhir/StructureDefinition/ImagingSelection) v5.0.0**

 A selection of DICOM SOP instances and/or frames

 A selection of DICOM SOP instances and/or frames within a single Study and Series. This might include additional specifics such as an image region, an Observation UID or a Segmentation Number, allowing linkage to an Observation Resource or transferring this information along with the ImagingStudy Resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImagingSelection(pub Box<ImagingSelectionInner>);
/** A selection of DICOM SOP instances and/or frames within a single Study and Series. This might include additional specifics such as an image region, an Observation UID or a Segmentation Number, allowing linkage to an Observation Resource or transferring this information along with the ImagingStudy Resource.

 **[ImagingSelection](http://hl7.org/fhir/StructureDefinition/ImagingSelection) v5.0.0**

 A selection of DICOM SOP instances and/or frames

 A selection of DICOM SOP instances and/or frames within a single Study and Series. This might include additional specifics such as an image region, an Observation UID or a Segmentation Number, allowing linkage to an Observation Resource or transferring this information along with the ImagingStudy 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 = "ImagingSelectionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImagingSelectionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImagingSelection::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImagingSelection", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Imaging Selection**

 A unique identifier assigned to this imaging selection.

 This is a business identifier, not a resource identifier -- see discussion under [Business Identifiers](resource.html#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>>,
    /** **[ImagingSelectionStatus](http://hl7.org/fhir/ValueSet/imagingselection-status); available | entered-in-error | unknown**

 The current state of the ImagingSelection resource. This is not the status of any ImagingStudy, ServiceRequest, or Task resources associated with the ImagingSelection.

 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. */
    #[serde(rename = "status")]
    pub status: codes::ImagingSelectionStatus,
    /// 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>,
    /** **Subject of the selected instances**

 The patient, or group of patients, location, device, organization, procedure or practitioner this imaging selection is about and into whose or what record the imaging selection is placed.

 */
    #[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>,
    /** **Date / Time when this imaging selection was created**

 The date and time this imaging selection was created.

 */
    #[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>,
    /** **Selector of the instances (human or machine)**

 Selector of the instances – human or machine.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<ImagingSelectionPerformer>>,
    /// 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>>,
    /** **Associated request**

 A list of the diagnostic requests that resulted in this imaging selection 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>>,
    /** **[ImagingSelectionCode](http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_7010.html); Classifies the imaging selection**

 Classifies the imaging selection.

 */
    #[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>>,
    /** **[ImagingSelectionCode](http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_7010.html); Imaging Selection purpose text or code**

 Reason for referencing the selected content.

 *All* code-value and, if present, component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation. */
    #[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>,
    /** **DICOM Study Instance UID**

 The Study Instance UID for the DICOM Study from which the images were selected.

 See [DICOM PS3.3 C.7.2](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.2.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "studyUid")]
    pub study_uid: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_studyUid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub study_uid_ext: Option<FieldExtension>,
    /** **The imaging study from which the imaging selection is derived**

 The imaging study from which the imaging selection is made.

 */
    #[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>>,
    /** **The network service providing retrieval for the images referenced in the imaging selection**

 The network service providing retrieval access to the selected images, frames, etc. See implementation notes for information about using DICOM endpoints.

 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. */
    #[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>>,
    /** **DICOM Series Instance UID**

 The Series Instance UID for the DICOM Series from which the images were selected.

 See [DICOM PS3.3 C.7.3](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.3.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesUid")]
    pub series_uid: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_seriesUid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub series_uid_ext: Option<FieldExtension>,
    /** **DICOM Series Number**

 The Series Number for the DICOM Series from which the images were selected.

 See [DICOM PS3.3 C.7.3](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.3.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesNumber")]
    pub series_number: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_seriesNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub series_number_ext: Option<FieldExtension>,
    /** **The Frame of Reference UID for the selected images**

 The Frame of Reference UID identifying the coordinate system that conveys spatial and/or temporal information for the selected images or frames.

 See [DICOM PS3.3 C.7.4.1](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.4.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "frameOfReferenceUid")]
    pub frame_of_reference_uid: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_frameOfReferenceUid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub frame_of_reference_uid_ext: 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.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableReference>,
    /// 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>,
    /** **Related resource that is the focus for the imaging selection**

 The actual focus of an observation when it is not the patient of record representing something or someone associated with the patient such as a spouse, parent, fetus, or donor. For example, fetus observations in a mother's record.  The focus of an observation could also be an existing condition,  an intervention, the subject's diet,  another observation of the subject,  or a body structure such as tumor or implanted device.   An example use case would be using the Observation resource to capture whether the mother is trained to change her child's tracheostomy tube. In this example, the child is the patient of record and the mother is the focus.

 An imaging selection may reference a DICOM resource that itself references other DICOM resources.
       e.g. a presentation state references a set of source images or frames. */
    #[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>>,
    /** **The selected instances**

 Each imaging selection includes one or more selected DICOM SOP instances.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<ImagingSelectionInstance>>,
    /// 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 ImagingSelectionBuilder {
    #[doc = concat!("Finalize building ", "ImagingSelection", ".")]
    pub fn build(self) -> Result<ImagingSelection, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImagingSelectionInner> for ImagingSelection {
    fn from(inner: ImagingSelectionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImagingSelection {
    type Target = ImagingSelectionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImagingSelection {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImagingSelection {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImagingSelectionBuilder {
        ImagingSelectionBuilder::default()
    }
}
impl ImagingSelection {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImagingSelection
    }
}
/// Sub-fields of the performer field in ImagingSelection
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingSelectionPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingSelectionPerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EventPerformerFunction](http://hl7.org/fhir/ValueSet/series-performer-function); Type of performer**

 Distinguishes the type of involvement of the performer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Author (human or machine)**

 Author – human or machine.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ImagingSelectionPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingSelectionPerformerBuilder {
        ImagingSelectionPerformerBuilder::default()
    }
}
/// Sub-fields of the instance field in ImagingSelection
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingSelectionInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingSelectionInstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **DICOM SOP Instance UID**

 The SOP Instance UID for the selected DICOM instance.

 See [DICOM PS3.3 C.12.1](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.12.html). */
    #[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>,
    /** **DICOM Instance Number**

 The Instance Number for the selected DICOM instance.

 See [DICOM PS3.3 C.7.6.1](https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.html#sect_C.7.6.1).
       Note: A multiframe instance has a single instance number with each frame identified by a frame number. */
    #[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>,
    /** **[sopClass](http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1); DICOM SOP Class UID**

 The SOP Class UID for the selected DICOM instance.

 See [DICOM PS3.3 C.12.1](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.12.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sopClass")]
    pub sop_class: Option<Coding>,
    /// 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>,
    /** **The selected subset of the SOP Instance**

 Selected subset of the SOP Instance. The content and format of the subset item is determined by the SOP Class of the selected instance.
       May be one of:
       - A list of frame numbers selected from a multiframe SOP Instance.
       - A list of Content Item Observation UID values selected from a DICOM SR or other structured document SOP Instance.
       - A list of segment numbers selected from a segmentation SOP Instance.
       - A list of Region of Interest (ROI) numbers selected from a radiotherapy structure set SOP Instance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subset")]
    pub subset: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subset")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subset_ext: Vec<Option<FieldExtension>>,
    /** **A specific 2D region in a DICOM image / frame**

 Each imaging selection instance or frame list might includes an image region, specified by a region type and a set of 2D coordinates.
       If the parent imagingSelection.instance contains a subset element of type frame, the image region applies to all frames in the subset list.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "imageRegion2D")]
    pub image_region2_d: Vec<Option<ImagingSelectionInstanceImageRegion2D>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_imageRegion2D")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub image_region2_d_ext: Vec<Option<FieldExtension>>,
    /** **A specific 3D region in a DICOM frame of reference**

 Each imaging selection might includes a 3D image region, specified by a region type and a set of 3D coordinates.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "imageRegion3D")]
    pub image_region3_d: Vec<Option<ImagingSelectionInstanceImageRegion3D>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_imageRegion3D")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub image_region3_d_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingSelectionInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingSelectionInstanceBuilder {
        ImagingSelectionInstanceBuilder::default()
    }
}
/// Sub-fields of the imageRegion2D field in ImagingSelectionInstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingSelectionInstanceImageRegion2DBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingSelectionInstanceImageRegion2D {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImagingSelection2DGraphicType](http://hl7.org/fhir/ValueSet/imagingselection-2dgraphictype); point | polyline | interpolated | circle | ellipse**

 Specifies the type of image region.

 See [DICOM PS3.3 C.10.5.1.2](https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.10.5.html#sect_C.10.5.1.2). */
    #[serde(rename = "regionType")]
    pub region_type: codes::ImagingSelection2DGraphicType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_regionType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub region_type_ext: Option<FieldExtension>,
    /** **Specifies the coordinates that define the image region**

 The coordinates describing the image region. Encoded as a set of (column, row) pairs that denote positions in the selected image / frames specified with sub-pixel resolution.
       The origin at the TLHC of the TLHC pixel is 0.0\0.0, the BRHC of the TLHC pixel is 1.0\1.0, and the BRHC of the BRHC pixel is the number of columns\rows in the image / frames. The values must be within the range 0\0 to the number of columns\rows in the image / frames.

 For a description of how 2D coordinates are encoded, see [DICOM PS3.3 C.18.6](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.18.6.html). */
    #[serde(rename = "coordinate")]
    pub coordinate: Vec<Option<f64>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_coordinate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub coordinate_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingSelectionInstanceImageRegion2D {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingSelectionInstanceImageRegion2DBuilder {
        ImagingSelectionInstanceImageRegion2DBuilder::default()
    }
}
/// Sub-fields of the imageRegion3D field in ImagingSelectionInstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingSelectionInstanceImageRegion3DBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingSelectionInstanceImageRegion3D {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImagingSelection3DGraphicType](http://hl7.org/fhir/ValueSet/imagingselection-3dgraphictype); point | multipoint | polyline | polygon | ellipse | ellipsoid**

 Specifies the type of image region.

 See [DICOM PS3.3 C.18.9.1.2](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.18.9.html#sect_C.18.9.1.2). */
    #[serde(rename = "regionType")]
    pub region_type: codes::ImagingSelection3DGraphicType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_regionType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub region_type_ext: Option<FieldExtension>,
    /** **Specifies the coordinates that define the image region**

 The coordinates describing the image region. Encoded as an ordered set of (x,y,z) triplets (in mm and may be negative) that define a region of interest in the patient-relative Reference Coordinate System defined by ImagingSelection.frameOfReferenceUid element.

 For a description of how 3D coordinates are encoded, see [DICOM PS3.3 C.18.9](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.18.9.html). */
    #[serde(rename = "coordinate")]
    pub coordinate: Vec<Option<f64>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_coordinate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub coordinate_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingSelectionInstanceImageRegion3D {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingSelectionInstanceImageRegion3DBuilder {
        ImagingSelectionInstanceImageRegion3DBuilder::default()
    }
}
/** 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.

 **[ImagingStudy](http://hl7.org/fhir/StructureDefinition/ImagingStudy) v5.0.0**

 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>);
/** 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.

 **[ImagingStudy](http://hl7.org/fhir/StructureDefinition/ImagingStudy) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for the whole study**

 Identifiers for the ImagingStudy such as DICOM Study Instance UID.

 See discussion under [Imaging Study Implementation Notes](imagingstudy.html#notes) for encoding of DICOM Study Instance UID.  */
    #[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>>,
    /** **[ImagingStudyStatus](http://hl7.org/fhir/ValueSet/imagingstudy-status); registered | available | cancelled | entered-in-error | unknown**

 The current state of the ImagingStudy resource. This is not the status of any ServiceRequest or Task resources associated with the ImagingStudy.

 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. */
    #[serde(rename = "status")]
    pub status: codes::ImagingStudyStatus,
    /// 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>,
    /** **[ImagingModality](http://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_33.html); All of the distinct values for series' modalities**

 A list of all the distinct values of series.modality. This may include both acquisition and non-acquisition modalities.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modality")]
    pub modality: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modality")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modality_ext: Vec<Option<FieldExtension>>,
    /** **Who or what is the subject of the study**

 The subject, typically a patient, of the imaging study.

 QA phantoms can be recorded with a Device; multiple subjects (such as mice) can be recorded with a Group. */
    #[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 with which this imaging study is associated**

 The healthcare event (e.g. a patient and healthcare provider interaction) during which this ImagingStudy 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 but still be tied to the context of the encounter (e.g. pre-admission test). */
    #[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 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>>,
    /** **Part of referenced event**

 A larger event of which this particular ImagingStudy is a component or step.  For example,  an ImagingStudy as part of a procedure.

 To link an ImagingStudy to an Encounter use `encounter`. */
    #[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>>,
    /** **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>,
    /** **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.connectionType.

 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>,
    /** **[ImagingProcedureCode](http://loinc.org/vs/loinc-rsna-radiology-playbook); The performed procedure or code**

 This field corresponds to the DICOM Procedure Code Sequence (0008,1032). This is different from the FHIR Procedure resource that may include the ImagingStudy.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Where ImagingStudy occurred**

 The principal physical location where the ImagingStudy was performed.

 */
    #[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>,
    /** **[ImagingReason](http://hl7.org/fhir/ValueSet/procedure-reason); Why the study was requested / performed**

 Description of clinical condition indicating why the ImagingStudy was requested, and/or Indicates another resource whose existence justifies this Study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **User-defined comments**

 Per the recommended DICOM mapping, this element is derived from the Study Description attribute (0008,1030). Observations or findings about the imaging study should be recorded in another resource, e.g. Observation, and not in this 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>>,
    /** **Institution-generated description**

 The Imaging Manager description of the study. Institution-generated description or classification of the Study (component) 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **DICOM Series Instance UID for the series**

 The DICOM Series Instance UID for the series.

 See [DICOM PS3.3 C.7.3](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.3.html). */
    #[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://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_33.html); The modality used for this series**

 The distinct modality for this series. This may include both acquisition and non-acquisition modalities.

 */
    #[serde(rename = "modality")]
    pub modality: CodeableConcept,
    /// 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>,
    /** **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.connectionType.

 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<CodeableReference>,
    /// 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://dicom.nema.org/medical/dicom/current/output/chtml/part16/sect_CID_244.html); 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<CodeableConcept>,
    /// 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>,
    /** **Specimen imaged**

 The specimen imaged, e.g., for whole slide imaging of a biopsy.

 */
    #[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>>,
    /** **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**

 Indicates who or what performed the series and how they were involved.

 If the person who performed the series is not known, their Organization may be recorded. A patient, or related person, may be the performer, e.g. for patient-captured images. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<ImagingStudySeriesPerformer>>,
    /// 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 performer 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 = "ImagingStudySeriesPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingStudySeriesPerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EventPerformerFunction](http://hl7.org/fhir/ValueSet/series-performer-function); Type of performance**

 Distinguishes the type of involvement of the performer in the series.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who performed the series**

 Indicates who or what performed the series.

 */
    #[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 ImagingStudySeriesPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingStudySeriesPerformerBuilder {
        ImagingStudySeriesPerformerBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **DICOM SOP Instance UID**

 The DICOM SOP Instance UID for this image or other DICOM content.

 See  [DICOM PS3.3 C.12.1](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.12.html#sect_C.12.1). */
    #[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>,
    /** **[sopClass](http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1); DICOM class type**

 DICOM instance  type.

 */
    #[serde(rename = "sopClass")]
    pub sop_class: Coding,
    /// 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>,
    /** **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>,
    /** **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()
    }
}
/** Describes the event of a patient being administered a vaccine or a record of an immunization as reported by a patient, a clinician or another party.

 **[Immunization](http://hl7.org/fhir/StructureDefinition/Immunization) v5.0.0**

 Immunization event information

 Describes the event of a patient being administered a vaccine or a record of an immunization as reported by a patient, a clinician or another party.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Immunization(pub Box<ImmunizationInner>);
/** Describes the event of a patient being administered a vaccine or a record of an immunization as reported by a patient, a clinician or another party.

 **[Immunization](http://hl7.org/fhir/StructureDefinition/Immunization) v5.0.0**

 Immunization event information

 Describes the event of a patient being administered a vaccine or a record of an immunization as reported by a patient, a clinician or another party.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Authority that the immunization event is based on**

 A plan, order or recommendation fulfilled in whole or in part by this immunization.

 Allows tracing of an authorization for the Immunization. */
    #[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>>,
    /** **[ImmunizationStatus](http://hl7.org/fhir/ValueSet/immunization-status); completed | entered-in-error | not-done**

 Indicates the current status of the immunization event.

 Will generally be set to show that the immunization has been completed or not done.  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>,
    /** **[ImmunizationStatusReason](http://hl7.org/fhir/ValueSet/immunization-status-reason); Reason for current status**

 Indicates the reason the immunization event was not performed.

 This is generally only used for the status of "not-done". The reason for performing the immunization event is captured in reasonCode, not here. */
    #[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>,
    /** **[VaccineCode](http://hl7.org/fhir/ValueSet/vaccine-code); Vaccine administered**

 Vaccine that was administered or was to be administered.

 The code for the administered vaccine may be reported at various levels of granularity from a very generic code for a general type of vaccine (e.g. the SNOMED or CVX code for the flu vaccine) to a very discrete code for a specific product including the form and packaging (e.g. an NDC code). Because vaccineCode uses the CodeableConcept data type, multiple codes at different levels of granularity may be reported for a single immunization event provided that all codes are appropriate for the same vaccine. For example, both NDC and CVX codes may be provided for a given immunization event by repeating the coding element within vaccineCode. */
    #[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>,
    /** **Product that was administered**

 An indication of which product was administered to the patient. This is typically a more detailed representation of the concept conveyed by the vaccineCode data element. If a Medication resource is referenced, it may be to a stand-alone resource or a contained resource within the Immunization resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administeredProduct")]
    pub administered_product: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_administeredProduct")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub administered_product_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<CodeableReference>,
    /// 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>,
    /** **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 immunization was 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>,
    /** **Additional information in support of the immunization**

 Additional information that is relevant to the immunization (e.g. for a vaccine recipient who is pregnant, the gestational age of the fetus). The reason why a vaccine was given (e.g. occupation, underlying medical condition) should be conveyed in Immunization.reason, not as supporting information. The reason why a vaccine was not given (e.g. contraindication) should be conveyed in Immunization.statusReason, not as supporting information.

 */
    #[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>>,
    /** **Vaccine 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. An exact date is always preferable, but the use of the String data type is acceptable when an exact date is not known. A small number of vaccines (e.g. live oral typhoid vaccine) are given as a series of patient self-administered dose over a span of time. In cases like this, often, only the first dose (typically a provider supervised dose) is recorded with the occurrence indicating the date/time of the first dose. */
    #[serde(flatten)]
    pub occurrence: ImmunizationOccurrence,
    /// 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<ImmunizationOccurrenceExtension>,
    /** **Indicates context the data was captured in**

 Indicates whether the data contained in the resource was captured by the individual/organization which was responsible for the administration of the vaccine rather than as 'secondary reported' data documented by a third party. A value of 'true' means this data originated with the individual/organization which was responsible for the administration of the vaccine.

 Reflects the “reliability” of the content. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "primarySource")]
    pub primary_source: Option<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  reported record**

 Typically the source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.

 Typically will not be populated if primarySource = True, not required even if primarySource = False. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSource")]
    pub information_source: Option<CodeableReference>,
    /// 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>,
    /** **Where immunization 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>,
    /** **[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 performed the immunization event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<ImmunizationPerformer>>,
    /// 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>>,
    /** **Additional immunization 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>>,
    /** **[ImmunizationReason](http://hl7.org/fhir/ValueSet/immunization-reason); Why immunization occurred**

 Describes why the immunization occurred in coded or textual form, or Indicates another resource (Condition, Observation or DiagnosticReport) whose existence justifies this immunization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Dose potency**

 Indication if a dose is considered to be subpotent. By default, a dose should be considered to be potent.

 Typically, the recognition of the dose being sub-potent is retrospective, after the administration (ex. notification of a manufacturer recall after administration). However, in the case of a partial administration (the patient moves unexpectedly and only some of the dose is actually administered), subpotency may be recognized immediately, but it is still important to record the event. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isSubpotent")]
    pub is_subpotent: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isSubpotent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_subpotent_ext: Option<FieldExtension>,
    /** **[SubpotentReason](http://hl7.org/fhir/ValueSet/immunization-subpotent-reason); Reason for being subpotent**

 Reason why a dose is considered to be subpotent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subpotentReason")]
    pub subpotent_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subpotentReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subpotent_reason_ext: Vec<Option<FieldExtension>>,
    /** **Patient eligibility for a specific vaccination program**

 Indicates a patient's eligibility for a funding program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programEligibility")]
    pub program_eligibility: Vec<Option<ImmunizationProgramEligibility>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programEligibility")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_eligibility_ext: Vec<Option<FieldExtension>>,
    /** **[FundingSource](http://hl7.org/fhir/ValueSet/immunization-funding-source); Funding source for the vaccine**

 Indicates the source of the vaccine actually administered. This may be different than the patient eligibility (e.g. the patient may be eligible for a publically purchased vaccine but due to inventory issues, vaccine purchased with private funds was actually administered).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fundingSource")]
    pub funding_source: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fundingSource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub funding_source_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 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>>,
    /** **Protocol followed by the provider**

 The protocol (set of recommendations) being followed by the provider who administered the dose.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protocolApplied")]
    pub protocol_applied: Vec<Option<ImmunizationProtocolApplied>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_protocolApplied")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub protocol_applied_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
    }
}
/// Choice of types for the occurrence[x] field in Immunization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImmunizationOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the String type.
    #[serde(rename = "occurrenceString")]
    String(String),
}
/// Extension value for ImmunizationOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImmunizationOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_occurrenceString")]
    String(FieldExtension),
}
/// Sub-fields of the performer 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 = "ImmunizationPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationPerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImmunizationFunction](http://hl7.org/fhir/ValueSet/immunization-function); 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 = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Individual or organization who was performing**

 The practitioner or organization who performed the action.

 When the individual practitioner who performed the action is known, it is best to send. */
    #[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 ImmunizationPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationPerformerBuilder {
        ImmunizationPerformerBuilder::default()
    }
}
/// Sub-fields of the programEligibility 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 = "ImmunizationProgramEligibilityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationProgramEligibility {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[VaccineFundingProgram](http://hl7.org/fhir/ValueSet/immunization-vaccine-funding-program); The program that eligibility is declared for**

 Indicates which program the patient had their eligility evaluated for.

 */
    #[serde(rename = "program")]
    pub program: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_program")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub program_ext: Option<FieldExtension>,
    /** **[ProgramEligibility](http://hl7.org/fhir/ValueSet/immunization-program-eligibility); The patient's eligibility status for the program**

 Indicates the patient's eligility status for for a specific payment program.

 */
    #[serde(rename = "programStatus")]
    pub program_status: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_programStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub program_status_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationProgramEligibility {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationProgramEligibilityBuilder {
        ImmunizationProgramEligibilityBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 = "manifestation")]
    pub manifestation: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manifestation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manifestation_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 protocolApplied 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 = "ImmunizationProtocolAppliedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationProtocolApplied {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **Who is responsible for publishing the recommendations**

 Indicates the authority who published the protocol (e.g. ACIP) that is being followed.

 */
    #[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>,
    /** **[TargetDisease](http://hl7.org/fhir/ValueSet/immunization-target-disease); Vaccine preventatable disease being targeted**

 The vaccine preventable disease the dose is being administered against.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[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>>,
    /** **Dose number within series**

 Nominal position in a series as intended by the practitioner administering the dose.

 The use of an integer is preferred if known. Text should only be used in cases where an integer is not available (such as when documenting a recurring booster dose). */
    #[serde(rename = "doseNumber")]
    pub dose_number: String,
    /// 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>,
    /** **Recommended number of doses for immunity**

 The recommended number of doses to achieve immunity as intended by the practitioner administering the dose.

 The use of an integer is preferred if known. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesDoses")]
    pub series_doses: Option<String>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl ImmunizationProtocolApplied {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationProtocolAppliedBuilder {
        ImmunizationProtocolAppliedBuilder::default()
    }
}
/** Describes a comparison of an immunization event against published recommendations to determine if the administration is "valid" in relation to those  recommendations.

 **[ImmunizationEvaluation](http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation) v5.0.0**

 Immunization evaluation information

 Describes a comparison of an immunization event against published recommendations to determine if the administration is "valid" in relation to those  recommendations.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImmunizationEvaluation(pub Box<ImmunizationEvaluationInner>);
/** Describes a comparison of an immunization event against published recommendations to determine if the administration is "valid" in relation to those  recommendations.

 **[ImmunizationEvaluation](http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation) v5.0.0**

 Immunization evaluation information

 Describes a comparison of an immunization event against published recommendations to determine if the administration is "valid" in relation to those  recommendations.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationEvaluationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImmunizationEvaluationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImmunizationEvaluation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImmunizationEvaluation", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 evaluation 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>>,
    /** **[ImmunizationEvaluationStatus](http://hl7.org/fhir/ValueSet/immunization-evaluation-status); completed | entered-in-error**

 Indicates the current status of the evaluation of the vaccination administration event.

 */
    #[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>,
    /** **Who this evaluation is for**

 The individual for whom the evaluation is being done.

 */
    #[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>,
    /** **Date evaluation was performed**

 The date the evaluation of the vaccine administration event was performed.

 */
    #[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 responsible for publishing the recommendations**

 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>,
    /** **[EvaluationTargetDisease](http://hl7.org/fhir/ValueSet/immunization-target-disease); The vaccine preventable disease schedule being evaluated**

 The vaccine preventable disease the dose is being evaluated against.

 */
    #[serde(rename = "targetDisease")]
    pub target_disease: 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>,
    /** **Immunization being evaluated**

 The vaccine administration event being evaluated.

 */
    #[serde(rename = "immunizationEvent")]
    pub immunization_event: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_immunizationEvent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub immunization_event_ext: Option<FieldExtension>,
    /** **[EvaluationDoseStatus](http://hl7.org/fhir/ValueSet/immunization-evaluation-dose-status); Status of the dose relative to published recommendations**

 Indicates if the dose is valid or not valid with respect to the published recommendations.

 */
    #[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>,
    /** **[EvaluationDoseStatusReason](http://hl7.org/fhir/ValueSet/immunization-evaluation-dose-status-reason); Reason why the doese is considered valid, invalid or some other status**

 Provides an explanation as to why the vaccine administration event is valid or not relative to the published recommendations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseStatusReason")]
    pub dose_status_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_doseStatusReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dose_status_reason_ext: Vec<Option<FieldExtension>>,
    /** **Evaluation notes**

 Additional information about the evaluation.

 */
    #[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>,
    /** **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>,
    /** **Dose number within series**

 Nominal position in a series as determined by the outcome of the evaluation process.

 The use of an integer is preferred if known. A string should only be used in cases where an integer is not available (such as when documenting a recurring booster dose). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseNumber")]
    pub dose_number: Option<String>,
    /// 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>,
    /** **Recommended number of doses for immunity**

 The recommended number of doses to achieve immunity as determined by the outcome of the evaluation process.

 The use of an integer is preferred if known. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesDoses")]
    pub series_doses: Option<String>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl ImmunizationEvaluationBuilder {
    #[doc = concat!("Finalize building ", "ImmunizationEvaluation", ".")]
    pub fn build(self) -> Result<ImmunizationEvaluation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImmunizationEvaluationInner> for ImmunizationEvaluation {
    fn from(inner: ImmunizationEvaluationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImmunizationEvaluation {
    type Target = ImmunizationEvaluationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImmunizationEvaluation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImmunizationEvaluation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImmunizationEvaluationBuilder {
        ImmunizationEvaluationBuilder::default()
    }
}
impl ImmunizationEvaluation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImmunizationEvaluation
    }
}
/** A patient's point-in-time set of recommendations (i.e. forecasting) according to a published schedule with optional supporting justification.

 **[ImmunizationRecommendation](http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) v5.0.0**

 Guidance or advice relating to an immunization

 A patient's point-in-time set of recommendations (i.e. forecasting) according to a published schedule with optional supporting justification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImmunizationRecommendation(pub Box<ImmunizationRecommendationInner>);
/** A patient's point-in-time set of recommendations (i.e. forecasting) according to a published schedule with optional supporting justification.

 **[ImmunizationRecommendation](http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) v5.0.0**

 Guidance or advice relating to an immunization

 A patient's point-in-time set of recommendations (i.e. forecasting) 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 recommendation(s) 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>,
    /** **Date recommendation(s) created**

 The date the immunization recommendation(s) were 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>,
    /** **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>,
    /** **Vaccine administration recommendations**

 Vaccine administration recommendations.

 A given instance of the .recommendation backbone element should correspond to a single recommended administration. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[VaccineCode](http://hl7.org/fhir/ValueSet/vaccine-code); Vaccine  or vaccine group recommendation applies to**

 Vaccine(s) or vaccine group that pertain to the recommendation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "vaccineCode")]
    pub vaccine_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_vaccineCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub vaccine_code_ext: Vec<Option<FieldExtension>>,
    /** **[TargetDisease](http://hl7.org/fhir/ValueSet/immunization-target-disease); Disease to be immunized against**

 The targeted disease for the recommendation.

 A given instance of the .recommendation backbone element should correspond to a single recommended administration but sometimes that administration (e.g. MMR) will encompass multiple diseases, thus the targetDisease element is allowed to repeat. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[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>>,
    /** **[VaccineCode](http://hl7.org/fhir/ValueSet/vaccine-code); Vaccine which is contraindicated to fulfill the recommendation**

 Vaccine(s) which should not be used to fulfill the recommendation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contraindicatedVaccineCode")]
    pub contraindicated_vaccine_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contraindicatedVaccineCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contraindicated_vaccine_code_ext: Vec<Option<FieldExtension>>,
    /** **[ImmunizationRecommendationStatus](http://hl7.org/fhir/ValueSet/immunization-recommendation-status); Vaccine recommendation status**

 Indicates the patient status with respect to the path to immunity for the target disease.

 */
    #[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>,
    /** **[ImmunizationRecommendationReason](http://hl7.org/fhir/ValueSet/immunization-recommendation-reason); Vaccine administration status reason**

 The reason for the assigned forecast status.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "forecastReason")]
    pub forecast_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_forecastReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub forecast_reason_ext: Vec<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 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>,
    /** **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>,
    /** **Recommended dose number within series**

 Nominal position of the recommended dose in a series as determined by the evaluation and forecasting process (e.g. dose 2 is the next recommended dose).

 The use of an integer is preferred if known. A string should only be used in cases where an integer is not available (such as when documenting a recurring booster dose). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseNumber")]
    pub dose_number: Option<String>,
    /// 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>,
    /** **Recommended number of doses for immunity**

 The recommended number of doses to achieve immunity as determined by the evaluation and forecasting process.

 The use of an integer is preferred if known. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesDoses")]
    pub series_doses: Option<String>,
    /// 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>,
    /** **Past immunizations supporting recommendation**

 Immunization event history and/or evaluation 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** A set of rules of how a particular interoperability or standards problem is solved - typically through the use of FHIR resources. 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.

 **[ImplementationGuide](http://hl7.org/fhir/StructureDefinition/ImplementationGuide) v5.0.0**

 A set of rules about how FHIR is used

 A set of rules of how a particular interoperability or standards problem is solved - typically through the use of FHIR resources. 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>);
/** A set of rules of how a particular interoperability or standards problem is solved - typically through the use of FHIR resources. 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.

 **[ImplementationGuide](http://hl7.org/fhir/StructureDefinition/ImplementationGuide) v5.0.0**

 A set of rules about how FHIR is used

 A set of rules of how a particular interoperability or standards problem is solved - typically through the use of FHIR resources. 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this implementation guide, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this implementation guide is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the implementation guide is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 implementation guide (business identifier)**

 A formal identifier that is used to identify this implementation guide when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **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 reference to a particular business version of the implementation guide with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ImplementationGuideVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ImplementationGuideVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 implementation guide (human friendly)**

 A short, descriptive, user-friendly title for the implementation guide.

 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 implementation guide. Enables tracking the life-cycle of the content.

 Allows filtering of implementation guides that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 guides that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the implementation guide was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 implementation guide is presumed to be the predominant language in the place the implementation guide 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate implementation guide instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 implementation guide is defined**

 Explanation of why this implementation guide is needed and why it has been designed as it has.

 This element does not describe the usage of the implementation guide. 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 implementation guide. */
    #[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 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **NPM Package name for IG**

 The NPM package name for this Implementation Guide, used in the NPM package distribution, which is the primary mechanism by which FHIR based tooling manages IG dependencies. This value must be globally unique, and should be assigned with care.

 Many (if not all) IG publishing tools will require that this element be present. For implementation guides published through HL7 or the FHIR foundation, the FHIR product director assigns package IDs. */
    #[serde(rename = "packageId")]
    pub package_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packageId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub package_id_ext: Option<FieldExtension>,
    /** **[SPDXLicense](http://hl7.org/fhir/ValueSet/spdx-license); SPDX license code for this IG (or not-open-source)**

 The license that applies to this Implementation Guide, using an SPDX license code, or 'not-open-source'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "license")]
    pub license: Option<codes::SPDXLicense>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_license")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub license_ext: Option<FieldExtension>,
    /** **[FHIRVersion](http://hl7.org/fhir/ValueSet/FHIR-version); FHIR Version(s) this Implementation Guide targets**

 The version(s) of the FHIR specification that this ImplementationGuide targets - e.g. describes how to use. The value of this element is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 4.6.0. for this version.

 Most implementation guides target a single version - e.g. they describe how to use a particular version, and the profiles and examples etc. are valid for that version. But some implementation guides describe how to use multiple different versions of FHIR to solve the same problem, or in concert with each other. Typically, the requirement to support multiple versions arises as implementation matures and different implementation communities are stuck at different versions by regulation or market dynamics. */
    #[serde(rename = "fhirVersion")]
    pub fhir_version: Vec<Option<codes::FHIRVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fhirVersion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fhir_version_ext: Vec<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 = "dependsOn")]
    pub depends_on: Vec<Option<ImplementationGuideDependsOn>>,
    /// 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>>,
    /** **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>>,
    /** **Information needed to build the IG**

 The information needed by an IG publisher tool to publish the whole implementation guide.

 Principally, this consists of information abuot source resource and file locations, and build parameters and templates. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<ImplementationGuideDefinition>,
    /// 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>,
    /** **Information about an assembled IG**

 Information about an assembled implementation guide, created by the publication tooling.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manifest")]
    pub manifest: Option<ImplementationGuideManifest>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manifest")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manifest_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
    }
}
/// Choice of types for the versionAlgorithm[x] field in ImplementationGuide
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuideVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ImplementationGuideVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuideVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the dependsOn 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 = "ImplementationGuideDependsOnBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDependsOn {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identity of the IG that this depends on**

 A canonical reference to the Implementation guide for the dependency.

 Usually, A canonical reference to the implementation guide is the same as the master location at which the implementation guide is published. */
    #[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>,
    /** **NPM Package name for IG this depends on**

 The NPM package name for the Implementation Guide that this IG depends on.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageId")]
    pub package_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packageId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub package_id_ext: Option<FieldExtension>,
    /** **Version of the IG**

 The version of the IG that is depended on, when the correct version is required to understand the IG correctly.

 This follows the syntax of the NPM packaging version field - see [[reference]]. */
    #[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>,
    /** **Why dependency exists**

 A description explaining the nature of the dependency on the listed IG.

 This doesn't need to enumerate every resource used, but should give some sense of why the dependency exists.  It will be used in the rendered list of dependencies */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<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>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDependsOn {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDependsOnBuilder {
        ImplementationGuideDependsOnBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 profile 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: 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>,
    /** **Profile that all resources must conform to**

 A reference to the profile that all instances must conform to.

 */
    #[serde(rename = "profile")]
    pub profile: 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>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideGlobal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideGlobalBuilder {
        ImplementationGuideGlobalBuilder::default()
    }
}
/// Sub-fields of the definition 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 = "ImplementationGuideDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinition {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Grouping used to present related resources in the IG**

 A logical group of resources. Logical groups can be used when building pages.

 Groupings are arbitrary sub-divisions of content. Typically, they are used to help build Table of Contents automatically. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "grouping")]
    pub grouping: Vec<Option<ImplementationGuideDefinitionGrouping>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_grouping")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub grouping_ext: Vec<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(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Vec<Option<ImplementationGuideDefinitionResource>>,
    /// 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>>,
    /** **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<ImplementationGuideDefinitionPage>,
    /// 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>,
    /** **Defines how IG is built by tools**

 A set of parameters that defines how the implementation guide is built. The parameters are defined by the relevant tools that build the implementation guides.

 see [confluence](https://confluence.hl7.org/display/FHIR/Implementation+Guide+Parameters) for the parameters defined by the HL7 IG publisher. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<ImplementationGuideDefinitionParameter>>,
    /// 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>>,
    /** **A template for building resources**

 A template for building resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "template")]
    pub template: Vec<Option<ImplementationGuideDefinitionTemplate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_template")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub template_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDefinition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionBuilder {
        ImplementationGuideDefinitionBuilder::default()
    }
}
/// Sub-fields of the grouping field in ImplementationGuideDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDefinitionGroupingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinitionGrouping {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the package**

 The human-readable title to display for the package of resources when rendering the implementation guide.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDefinitionGrouping {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionGroupingBuilder {
        ImplementationGuideDefinitionGroupingBuilder::default()
    }
}
/// Sub-fields of the resource field in ImplementationGuideDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDefinitionResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinitionResource {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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(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>,
    /** **[FHIRVersion](http://hl7.org/fhir/ValueSet/FHIR-version); Versions this applies to (if different to IG)**

 Indicates the FHIR Version(s) this artifact is intended to apply to. If no versions are specified, the resource is assumed to apply to all the versions stated in ImplementationGuide.fhirVersion.

 The resource SHALL be valid against all the versions it is specified to apply to. If the resource referred to is a StructureDefinition, the fhirVersion stated in the StructureDefinition cannot disagree with the version specified here; the specified versions SHALL include the version specified by the StructureDefinition, and may include additional versions using the [http://hl7.org/fhir/StructureDefinition/structuredefinition-applicable-version](http://hl7.org/fhir/extensions/StructureDefinition-structuredefinition-applicable-version.html) extension. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fhirVersion")]
    pub fhir_version: Vec<Option<codes::FHIRVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fhirVersion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fhir_version_ext: Vec<Option<FieldExtension>>,
    /** **Human readable 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>,
    /** **Is this an example**

 If true, indicates the resource is an example instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isExample")]
    pub is_example: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isExample")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_example_ext: Option<FieldExtension>,
    /** **Profile(s) this is an example of**

 If present, indicates profile(s) the instance is valid against.

 Examples:

* StructureDefinition -> Any
* ValueSet -> expansion
* OperationDefinition -> Parameters
* Questionnaire -> QuestionnaireResponse. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Vec<Option<String>>,
    /// 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>>,
    /** **Grouping this is part of**

 Reference to the id of the grouping this resource appears in.

 This must correspond to a group.id element within this implementation guide. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupingId")]
    pub grouping_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupingId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub grouping_id_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDefinitionResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionResourceBuilder {
        ImplementationGuideDefinitionResourceBuilder::default()
    }
}
/// Sub-fields of the page field in ImplementationGuideDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDefinitionPageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinitionPage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Source for page**

 Indicates the URL or the actual content to provide for the page.

 If absent and the page isn't a generated page, this may be inferred from the page name by checking input locations.  String is used for XHTML content - sent as an escaped string.  FHIR tooling can't support 'direct' XHTML anywhere other than in narrative. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<ImplementationGuideDefinitionPageSource>,
    /// 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<ImplementationGuideDefinitionPageSourceExtension>,
    /** **Name of the page when published**

 The url by which the page should be known when published.

 This SHALL be a local reference, expressed with respect to the root of the IG output folder.  No suffix is required.  If no suffix is specified, .html will be appended. */
    #[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>,
    /** **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>,
    /** **[GuidePageGeneration](http://hl7.org/fhir/ValueSet/guide-page-generation); html | markdown | xml | generated**

 A code that indicates how the page is generated.

 */
    #[serde(rename = "generation")]
    pub generation: codes::GuidePageGeneration,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_generation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub generation_ext: Option<FieldExtension>,
    /** **Nested Pages / Sections**

 Nested Pages/Sections under this page.

 The implementation guide breadcrumbs may be 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<ImplementationGuideDefinitionPage>>,
    /// 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 ImplementationGuideDefinitionPage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionPageBuilder {
        ImplementationGuideDefinitionPageBuilder::default()
    }
}
/// Choice of types for the source[x] field in ImplementationGuideDefinitionPage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuideDefinitionPageSource {
    /// Variant accepting the Url type.
    #[serde(rename = "sourceUrl")]
    Url(String),
    /// Variant accepting the String type.
    #[serde(rename = "sourceString")]
    String(String),
    /// Variant accepting the Markdown type.
    #[serde(rename = "sourceMarkdown")]
    Markdown(String),
}
/// Extension value for ImplementationGuideDefinitionPageSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuideDefinitionPageSourceExtension {
    /// Variant accepting the Url extension.
    #[serde(rename = "_sourceUrl")]
    Url(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_sourceString")]
    String(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_sourceMarkdown")]
    Markdown(FieldExtension),
}
/// Sub-fields of the parameter field in ImplementationGuideDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDefinitionParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinitionParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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://hl7.org/fhir/ValueSet/guide-parameter-code); Code that identifies parameter**

 A tool-specific code that defines the parameter.

 */
    #[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>,
    /** **Value for named type**

 Value for named type.

 */
    #[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 ImplementationGuideDefinitionParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionParameterBuilder {
        ImplementationGuideDefinitionParameterBuilder::default()
    }
}
/// Sub-fields of the template field in ImplementationGuideDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDefinitionTemplateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDefinitionTemplate {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of template specified**

 Type of template specified.

 */
    #[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>,
    /** **The source location for the template**

 The source location for the template.

 */
    #[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>,
    /** **The scope in which the template applies**

 The scope in which the template applies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scope_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDefinitionTemplate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDefinitionTemplateBuilder {
        ImplementationGuideDefinitionTemplateBuilder::default()
    }
}
/// Sub-fields of the manifest 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 = "ImplementationGuideManifestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideManifest {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of rendered implementation guide**

 A pointer to official web page, PDF or other rendering of the implementation guide.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rendering")]
    pub rendering: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rendering")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rendering_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<ImplementationGuideManifestResource>>,
    /// 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>>,
    /** **HTML page within the parent IG**

 Information about a page within the IG.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "page")]
    pub page: Vec<Option<ImplementationGuideManifestPage>>,
    /// 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>>,
    /** **Image within the IG**

 Indicates a relative path to an image that exists within the IG.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "image")]
    pub image: Vec<Option<String>>,
    /// 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>>,
    /** **Additional linkable file in IG**

 Indicates the relative path of an additional non-page, non-image file that is part of the IG - e.g. zip, jar and similar files that could be the target of a hyperlink in a derived IG.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "other")]
    pub other: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_other")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub other_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideManifest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideManifestBuilder {
        ImplementationGuideManifestBuilder::default()
    }
}
/// Sub-fields of the resource field in ImplementationGuideManifest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideManifestResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideManifestResource {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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(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>,
    /** **Is this an example**

 If true, indicates the resource is an example instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isExample")]
    pub is_example: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isExample")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_example_ext: Option<FieldExtension>,
    /** **Profile(s) this is an example of**

 If present, indicates profile(s) the instance is valid against.

 Examples:

* StructureDefinition -> Any
* ValueSet -> expansion
* OperationDefinition -> Parameters
* Questionnaire -> QuestionnaireResponse. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Vec<Option<String>>,
    /// 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>>,
    /** **Relative path for page in IG**

 The relative path for primary page for this resource within the IG.

 Appending 'rendering' + "/" + this should resolve to the resource page. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relativePath")]
    pub relative_path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relativePath")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relative_path_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideManifestResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideManifestResourceBuilder {
        ImplementationGuideManifestResourceBuilder::default()
    }
}
/// Sub-fields of the page field in ImplementationGuideManifest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideManifestPageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideManifestPage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **HTML page name**

 Relative path to the page.

 Appending 'rendering' + "/" + this should resolve to the page. */
    #[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>,
    /** **Title of the page, for references**

 Label for the page intended for human display.

 */
    #[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>,
    /** **Anchor available on the page**

 The name of an anchor available on the page.

 Appending 'rendering' + "/" + page.name + "#" + page.anchor should resolve to the anchor. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "anchor")]
    pub anchor: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_anchor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub anchor_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideManifestPage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideManifestPageBuilder {
        ImplementationGuideManifestPageBuilder::default()
    }
}
/** An ingredient of a manufactured item or pharmaceutical product.

 **[Ingredient](http://hl7.org/fhir/StructureDefinition/Ingredient) v5.0.0**

 An ingredient of a manufactured item or pharmaceutical product

 An ingredient of a manufactured item or pharmaceutical product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Ingredient(pub Box<IngredientInner>);
/** An ingredient of a manufactured item or pharmaceutical product.

 **[Ingredient](http://hl7.org/fhir/StructureDefinition/Ingredient) v5.0.0**

 An ingredient of a manufactured item or pharmaceutical product

 An ingredient of a manufactured item or pharmaceutical product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "IngredientBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct IngredientInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Ingredient::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Ingredient", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 or code by which the ingredient can be referenced**

 The identifier(s) of this Ingredient that are assigned 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 = "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>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this ingredient. Enables tracking the life-cycle of the content.

 Allows filtering of ingredient that are appropriate for use versus not. */
    #[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>,
    /** **The product which this ingredient is a constituent part of**

 The product which this ingredient is a constituent part of.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "for")]
    pub r#for: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_for")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#for_ext: Vec<Option<FieldExtension>>,
    /** **[IngredientRole](http://hl7.org/fhir/ValueSet/ingredient-role); Purpose of the ingredient within the product, e.g. active, inactive**

 A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.

 */
    #[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>,
    /** **[IngredientFunction](http://hl7.org/fhir/ValueSet/ingredient-function); Precise action within the drug product, e.g. antioxidant, alkalizing agent**

 A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub function_ext: Vec<Option<FieldExtension>>,
    /** **A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink**

 A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Option<CodeableConcept>,
    /// 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>,
    /** **If the ingredient is a known or suspected allergen**

 If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allergenicIndicator")]
    pub allergenic_indicator: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_allergenicIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub allergenic_indicator_ext: Option<FieldExtension>,
    /** **A place for providing any notes that are relevant to the component, e.g. removed during process, adjusted for loss on drying**

 A place for providing any notes that are relevant to the component, e.g. removed during process, adjusted for loss on drying.

 */
    #[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>,
    /** **An organization that manufactures this ingredient**

 The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<IngredientManufacturer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **The substance that comprises this ingredient**

 The substance that comprises this ingredient.

 */
    #[serde(rename = "substance")]
    pub substance: IngredientSubstance,
    /// 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>,
}
#[cfg(feature = "builders")]
impl IngredientBuilder {
    #[doc = concat!("Finalize building ", "Ingredient", ".")]
    pub fn build(self) -> Result<Ingredient, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<IngredientInner> for Ingredient {
    fn from(inner: IngredientInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Ingredient {
    type Target = IngredientInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Ingredient {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Ingredient {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> IngredientBuilder {
        IngredientBuilder::default()
    }
}
impl Ingredient {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Ingredient
    }
}
/// Sub-fields of the manufacturer field in Ingredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "IngredientManufacturerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct IngredientManufacturer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[IngredientManufacturerRole](http://hl7.org/fhir/ValueSet/ingredient-manufacturer-role); allowed | possible | actual**

 The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<codes::IngredientManufacturerRole>,
    /// 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>,
    /** **An organization that manufactures this ingredient**

 An organization that manufactures this ingredient.

 */
    #[serde(rename = "manufacturer")]
    pub manufacturer: 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>,
}
#[cfg(feature = "builders")]
impl IngredientManufacturer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> IngredientManufacturerBuilder {
        IngredientManufacturerBuilder::default()
    }
}
/// Sub-fields of the substance field in Ingredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "IngredientSubstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct IngredientSubstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); A code or full resource that represents the ingredient substance**

 A code or full resource that represents the ingredient's substance.

 */
    #[serde(rename = "code")]
    pub code: CodeableReference,
    /// 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 quantity of substance, per presentation, or per volume or mass, and type of quantity**

 The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "strength")]
    pub strength: Vec<Option<IngredientSubstanceStrength>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_strength")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub strength_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl IngredientSubstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> IngredientSubstanceBuilder {
        IngredientSubstanceBuilder::default()
    }
}
/// Sub-fields of the strength field in IngredientSubstance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "IngredientSubstanceStrengthBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct IngredientSubstanceStrength {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 quantity of substance in the unit of presentation**

 The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub presentation: Option<IngredientSubstanceStrengthPresentation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub presentation_ext: Option<IngredientSubstanceStrengthPresentationExtension>,
    /** **Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio)**

 A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "textPresentation")]
    pub text_presentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_textPresentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_presentation_ext: Option<FieldExtension>,
    /** **The strength per unitary volume (or mass)**

 The strength per unitary volume (or mass).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub concentration: Option<IngredientSubstanceStrengthConcentration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub concentration_ext: Option<IngredientSubstanceStrengthConcentrationExtension>,
    /** **Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio)**

 A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "textConcentration")]
    pub text_concentration: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_textConcentration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_concentration_ext: Option<FieldExtension>,
    /** **A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt)**

 A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Option<CodeableConcept>,
    /// 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>,
    /** **When strength is measured at a particular point or distance**

 For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measurementPoint")]
    pub measurement_point: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementPoint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_point_ext: Option<FieldExtension>,
    /** **[Country](http://hl7.org/fhir/ValueSet/country); Where the strength range applies**

 The country or countries for which the strength range applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "country")]
    pub country: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_country")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub country_ext: Vec<Option<FieldExtension>>,
    /** **Strength expressed in terms of a reference substance**

 Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceStrength")]
    pub reference_strength: Vec<Option<IngredientSubstanceStrengthReferenceStrength>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referenceStrength")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_strength_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl IngredientSubstanceStrength {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> IngredientSubstanceStrengthBuilder {
        IngredientSubstanceStrengthBuilder::default()
    }
}
/// Choice of types for the presentation[x] field in IngredientSubstanceStrength
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthPresentation {
    /// Variant accepting the Ratio type.
    #[serde(rename = "presentationRatio")]
    Ratio(Ratio),
    /// Variant accepting the RatioRange type.
    #[serde(rename = "presentationRatioRange")]
    RatioRange(RatioRange),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "presentationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "presentationQuantity")]
    Quantity(Quantity),
}
/// Extension value for IngredientSubstanceStrengthPresentation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthPresentationExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_presentationRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the RatioRange extension.
    #[serde(rename = "_presentationRatioRange")]
    RatioRange(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_presentationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_presentationQuantity")]
    Quantity(FieldExtension),
}
/// Choice of types for the concentration[x] field in IngredientSubstanceStrength
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthConcentration {
    /// Variant accepting the Ratio type.
    #[serde(rename = "concentrationRatio")]
    Ratio(Ratio),
    /// Variant accepting the RatioRange type.
    #[serde(rename = "concentrationRatioRange")]
    RatioRange(RatioRange),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "concentrationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "concentrationQuantity")]
    Quantity(Quantity),
}
/// Extension value for IngredientSubstanceStrengthConcentration.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthConcentrationExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_concentrationRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the RatioRange extension.
    #[serde(rename = "_concentrationRatioRange")]
    RatioRange(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_concentrationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_concentrationQuantity")]
    Quantity(FieldExtension),
}
/// Sub-fields of the referenceStrength field in IngredientSubstanceStrength
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "IngredientSubstanceStrengthReferenceStrengthBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct IngredientSubstanceStrengthReferenceStrength {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); Relevant reference substance**

 Relevant reference substance.

 */
    #[serde(rename = "substance")]
    pub substance: CodeableReference,
    /// 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>,
    /** **Strength expressed in terms of a reference substance**

 Strength expressed in terms of a reference substance.

 */
    #[serde(flatten)]
    pub strength: IngredientSubstanceStrengthReferenceStrengthStrength,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub strength_ext: Option<
        IngredientSubstanceStrengthReferenceStrengthStrengthExtension,
    >,
    /** **When strength is measured at a particular point or distance**

 For when strength is measured at a particular point or distance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measurementPoint")]
    pub measurement_point: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementPoint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_point_ext: Option<FieldExtension>,
    /** **[Country](http://hl7.org/fhir/ValueSet/country); Where the strength range applies**

 The country or countries for which the strength range applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "country")]
    pub country: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_country")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub country_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl IngredientSubstanceStrengthReferenceStrength {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> IngredientSubstanceStrengthReferenceStrengthBuilder {
        IngredientSubstanceStrengthReferenceStrengthBuilder::default()
    }
}
/// Choice of types for the strength[x] field in IngredientSubstanceStrengthReferenceStrength
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthReferenceStrengthStrength {
    /// Variant accepting the Ratio type.
    #[serde(rename = "strengthRatio")]
    Ratio(Ratio),
    /// Variant accepting the RatioRange type.
    #[serde(rename = "strengthRatioRange")]
    RatioRange(RatioRange),
    /// Variant accepting the Quantity type.
    #[serde(rename = "strengthQuantity")]
    Quantity(Quantity),
}
/// Extension value for IngredientSubstanceStrengthReferenceStrengthStrength.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum IngredientSubstanceStrengthReferenceStrengthStrengthExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_strengthRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the RatioRange extension.
    #[serde(rename = "_strengthRatioRange")]
    RatioRange(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_strengthQuantity")]
    Quantity(FieldExtension),
}
/** Details of a Health Insurance product/plan provided by an organization.

 **[InsurancePlan](http://hl7.org/fhir/StructureDefinition/InsurancePlan) v5.0.0**

 Details of a Health Insurance product/plan provided by an organization

 Details of a Health Insurance product/plan provided by an organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct InsurancePlan(pub Box<InsurancePlanInner>);
/** Details of a Health Insurance product/plan provided by an organization.

 **[InsurancePlan](http://hl7.org/fhir/StructureDefinition/InsurancePlan) v5.0.0**

 Details of a Health Insurance product/plan provided by an organization

 Details of a Health Insurance product/plan provided by 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 = "InsurancePlanBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct InsurancePlanInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "InsurancePlan::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::InsurancePlan", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Product**

 Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.

 */
    #[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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The current state of the health insurance product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<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>,
    /** **[InsurancePlanType](http://hl7.org/fhir/ValueSet/insuranceplan-type); Kind of product**

 The kind of health insurance product.

 */
    #[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>>,
    /** **Official name**

 Official name of the health insurance product as designated by the owner.

 If the name of the product/plan 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>,
    /** **Alternate names**

 A list of alternate names that the product 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 product/plan. */
    #[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>>,
    /** **When the product is available**

 The period of time that the health insurance product is available.

 */
    #[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>,
    /** **Product issuer**

 The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ownedBy")]
    pub owned_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ownedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub owned_by_ext: Option<FieldExtension>,
    /** **Product administrator**

 An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administeredBy")]
    pub administered_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_administeredBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub administered_by_ext: Option<FieldExtension>,
    /** **Where product applies**

 The geographic region in which a health insurance product's benefits apply.

 */
    #[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>>,
    /** **Official contact details relevant to the health insurance plan/product**

 The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.

 The address/telecom use code 'home' are not to be used. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ExtendedContactDetail>>,
    /// 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 endpoint**

 The technical endpoints providing access to services operated for the health insurance product.

 */
    #[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>>,
    /** **What networks are Included**

 Reference to the network included in the health insurance product.

 Networks are represented as a hierarchy of organization resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub network_ext: Vec<Option<FieldExtension>>,
    /** **Coverage details**

 Details about the coverage offered by the insurance product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Vec<Option<InsurancePlanCoverage>>,
    /// 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>>,
    /** **Plan details**

 Details about an insurance plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plan")]
    pub plan: Vec<Option<InsurancePlanPlan>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_plan")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub plan_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanBuilder {
    #[doc = concat!("Finalize building ", "InsurancePlan", ".")]
    pub fn build(self) -> Result<InsurancePlan, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<InsurancePlanInner> for InsurancePlan {
    fn from(inner: InsurancePlanInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for InsurancePlan {
    type Target = InsurancePlanInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for InsurancePlan {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl InsurancePlan {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> InsurancePlanBuilder {
        InsurancePlanBuilder::default()
    }
}
impl InsurancePlan {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::InsurancePlan
    }
}
/// Sub-fields of the coverage field in InsurancePlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanCoverageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanCoverage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of coverage**

 Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).

 */
    #[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>,
    /** **What networks provide coverage**

 Reference to the network that providing the type of coverage.

 Networks are represented as a hierarchy of organization resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub network_ext: Vec<Option<FieldExtension>>,
    /** **List of benefits**

 Specific benefits under this type of coverage.

 */
    #[serde(rename = "benefit")]
    pub benefit: Vec<Option<InsurancePlanCoverageBenefit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_benefit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub benefit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanCoverage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanCoverageBuilder {
        InsurancePlanCoverageBuilder::default()
    }
}
/// Sub-fields of the benefit field in InsurancePlanCoverage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanCoverageBenefitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanCoverageBenefit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of benefit**

 Type of benefit (primary care; speciality care; inpatient; outpatient).

 */
    #[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>,
    /** **Referral requirements**

 The referral requirements to have access/coverage for this benefit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **Benefit limits**

 The specific limits on the benefit.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "limit")]
    pub limit: Vec<Option<InsurancePlanCoverageBenefitLimit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_limit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub limit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanCoverageBenefit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanCoverageBenefitBuilder {
        InsurancePlanCoverageBenefitBuilder::default()
    }
}
/// Sub-fields of the limit field in InsurancePlanCoverageBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanCoverageBenefitLimitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanCoverageBenefitLimit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Maximum value allowed**

 The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.

 May also be called “eligible expense,” “payment allowance,” or “negotiated rate.”. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<Quantity>,
    /// 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>,
    /** **Benefit limit details**

 The specific limit on the benefit.

 Use `CodeableConcept.text` element if the data is free (uncoded) text. */
    #[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>,
}
#[cfg(feature = "builders")]
impl InsurancePlanCoverageBenefitLimit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanCoverageBenefitLimitBuilder {
        InsurancePlanCoverageBenefitLimitBuilder::default()
    }
}
/// Sub-fields of the plan field in InsurancePlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanPlanBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanPlan {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Product**

 Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.

 */
    #[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>>,
    /** **Type of plan**

 Type of plan. For example, "Platinum" or "High Deductable".

 */
    #[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 product applies**

 The geographic region in which a health insurance plan's benefits apply.

 */
    #[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>>,
    /** **What networks provide coverage**

 Reference to the network that providing the type of coverage.

 Networks are represented as a hierarchy of organization resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub network_ext: Vec<Option<FieldExtension>>,
    /** **Overall costs**

 Overall costs associated with the plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "generalCost")]
    pub general_cost: Vec<Option<InsurancePlanPlanGeneralCost>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_generalCost")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub general_cost_ext: Vec<Option<FieldExtension>>,
    /** **Specific costs**

 Costs associated with the coverage provided by the product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specificCost")]
    pub specific_cost: Vec<Option<InsurancePlanPlanSpecificCost>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specificCost")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specific_cost_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanPlan {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanPlanBuilder {
        InsurancePlanPlanBuilder::default()
    }
}
/// Sub-fields of the generalCost field in InsurancePlanPlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanPlanGeneralCostBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanPlanGeneralCost {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of cost**

 Type of cost.

 */
    #[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>,
    /** **Number of enrollees**

 Number of participants enrolled in the plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupSize")]
    pub group_size: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupSize")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_size_ext: Option<FieldExtension>,
    /** **Cost value**

 Value of the cost.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cost")]
    pub cost: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cost")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cost_ext: Option<FieldExtension>,
    /** **Additional cost information**

 Additional information about the general costs associated with this plan.

 */
    #[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 InsurancePlanPlanGeneralCost {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanPlanGeneralCostBuilder {
        InsurancePlanPlanGeneralCostBuilder::default()
    }
}
/// Sub-fields of the specificCost field in InsurancePlanPlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanPlanSpecificCostBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanPlanSpecificCost {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **General category of benefit**

 General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).

 */
    #[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>,
    /** **Benefits list**

 List of the specific benefits under this category of benefit.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefit")]
    pub benefit: Vec<Option<InsurancePlanPlanSpecificCostBenefit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_benefit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub benefit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanPlanSpecificCost {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanPlanSpecificCostBuilder {
        InsurancePlanPlanSpecificCostBuilder::default()
    }
}
/// Sub-fields of the benefit field in InsurancePlanPlanSpecificCost
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanPlanSpecificCostBenefitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanPlanSpecificCostBenefit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of specific benefit**

 Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).

 */
    #[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>,
    /** **List of the costs**

 List of the costs associated with a specific benefit.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cost")]
    pub cost: Vec<Option<InsurancePlanPlanSpecificCostBenefitCost>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_cost")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub cost_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InsurancePlanPlanSpecificCostBenefit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanPlanSpecificCostBenefitBuilder {
        InsurancePlanPlanSpecificCostBenefitBuilder::default()
    }
}
/// Sub-fields of the cost field in InsurancePlanPlanSpecificCostBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InsurancePlanPlanSpecificCostBenefitCostBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InsurancePlanPlanSpecificCostBenefitCost {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of cost**

 Type of cost (copay; individual cap; family cap; coinsurance; deductible).

 */
    #[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>,
    /** **[BenefitCostApplicability](http://hl7.org/fhir/ValueSet/insuranceplan-applicability); in-network | out-of-network | other**

 Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "applicability")]
    pub applicability: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_applicability")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applicability_ext: Option<FieldExtension>,
    /** **Additional information about the cost**

 Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualifiers")]
    pub qualifiers: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_qualifiers")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub qualifiers_ext: Vec<Option<FieldExtension>>,
    /** **The actual cost value**

 The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<Quantity>,
    /// 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 InsurancePlanPlanSpecificCostBenefitCost {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InsurancePlanPlanSpecificCostBenefitCostBuilder {
        InsurancePlanPlanSpecificCostBenefitCostBuilder::default()
    }
}
/** functional description of an inventory item used in inventory and supply-related workflows.

 **[InventoryItem](http://hl7.org/fhir/StructureDefinition/InventoryItem) v5.0.0**

 A functional description of an inventory item used in inventory and supply-related workflows

 A functional description of an inventory item used in inventory and supply-related workflows.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct InventoryItem(pub Box<InventoryItemInner>);
/** functional description of an inventory item used in inventory and supply-related workflows.

 **[InventoryItem](http://hl7.org/fhir/StructureDefinition/InventoryItem) v5.0.0**

 A functional description of an inventory item used in inventory and supply-related workflows

 A functional description of an inventory item used in inventory and supply-related workflows.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct InventoryItemInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "InventoryItem::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::InventoryItem", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 inventory item**

 Business identifier for the inventory 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>>,
    /** **[InventoryItemStatus](http://hl7.org/fhir/ValueSet/inventoryitem-status); active | inactive | entered-in-error | unknown**

 Status of the item entry.

 */
    #[serde(rename = "status")]
    pub status: codes::InventoryItemStatus,
    /// 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>,
    /** **Category or class of the item**

 Category or class of the item.

 */
    #[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>>,
    /** **Code designating the specific type of item**

 Code designating the specific type of item.

 */
    #[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 item name(s) - the brand name, or common name, functional name, generic name or others**

 The item name(s) - the brand name, or common name, functional name, generic name.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<InventoryItemName>>,
    /// 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>>,
    /** **Organization(s) responsible for the product**

 Organization(s) responsible for the product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsibleOrganization")]
    pub responsible_organization: Vec<Option<InventoryItemResponsibleOrganization>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_responsibleOrganization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub responsible_organization_ext: Vec<Option<FieldExtension>>,
    /** **Descriptive characteristics of the item**

 The descriptive characteristics of the inventory item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<InventoryItemDescription>,
    /// 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 usage status like recalled, in use, discarded**

 The usage status e.g. recalled, in use, discarded... This can be used to indicate that the items have been taken out of inventory, or are in use, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inventoryStatus")]
    pub inventory_status: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_inventoryStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub inventory_status_ext: Vec<Option<FieldExtension>>,
    /** **The base unit of measure - the unit in which the product is used or counted**

 The base unit of measure - the unit in which the product is used or counted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseUnit")]
    pub base_unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseUnit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_unit_ext: Option<FieldExtension>,
    /** **Net content or amount present in the item**

 Net content or amount present in the item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "netContent")]
    pub net_content: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_netContent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_content_ext: Option<FieldExtension>,
    /** **Association with other items or products**

 Association with other items or products.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "association")]
    pub association: Vec<Option<InventoryItemAssociation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_association")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub association_ext: Vec<Option<FieldExtension>>,
    /** **Characteristic of the item**

 The descriptive or identifying characteristics of the item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<InventoryItemCharacteristic>>,
    /// 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>>,
    /** **Instances or occurrences of the product**

 Instances or occurrences of the product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Option<InventoryItemInstance>,
    /// 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>,
    /** **Link to a product resource used in clinical workflows**

 Link to a product resource used in clinical workflows.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productReference")]
    pub product_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl InventoryItemBuilder {
    #[doc = concat!("Finalize building ", "InventoryItem", ".")]
    pub fn build(self) -> Result<InventoryItem, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<InventoryItemInner> for InventoryItem {
    fn from(inner: InventoryItemInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for InventoryItem {
    type Target = InventoryItemInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for InventoryItem {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl InventoryItem {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> InventoryItemBuilder {
        InventoryItemBuilder::default()
    }
}
impl InventoryItem {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::InventoryItem
    }
}
/// Sub-fields of the name field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemNameBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemName {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NameType](http://hl7.org/fhir/ValueSet/inventoryitem-nametype); The type of name e.g. 'brand-name', 'functional-name', 'common-name'**

 The type of name e.g. 'brand-name', 'functional-name', 'common-name'.

 */
    #[serde(rename = "nameType")]
    pub name_type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nameType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_type_ext: Option<FieldExtension>,
    /** **[NameLanguage](http://hl7.org/fhir/ValueSet/languages); The language used to express the item name**

 The language that the item name is expressed in.

 */
    #[serde(rename = "language")]
    pub language: 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>,
    /** **The name or designation of the item**

 The name or designation that the item is given.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl InventoryItemName {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemNameBuilder {
        InventoryItemNameBuilder::default()
    }
}
/// Sub-fields of the responsibleOrganization field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemResponsibleOrganizationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemResponsibleOrganization {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 role of the organization e.g. manufacturer, distributor, or other**

 The role of the organization e.g. manufacturer, distributor, etc.

 */
    #[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>,
    /** **An organization that is associated with the item**

 An organization that has an association with the item, e.g. manufacturer, distributor, responsible, etc.

 */
    #[serde(rename = "organization")]
    pub organization: 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>,
}
#[cfg(feature = "builders")]
impl InventoryItemResponsibleOrganization {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemResponsibleOrganizationBuilder {
        InventoryItemResponsibleOrganizationBuilder::default()
    }
}
/// Sub-fields of the description field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemDescriptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemDescription {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ItemDescriptionLanguage](http://hl7.org/fhir/ValueSet/languages); The language that is used in the item description**

 The language for the item description, when an item must be described in different languages and those languages may be authoritative and not translations of a 'main' language.

 */
    #[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>,
    /** **Textual description of the item**

 Textual description of the item.

 */
    #[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 InventoryItemDescription {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemDescriptionBuilder {
        InventoryItemDescriptionBuilder::default()
    }
}
/// Sub-fields of the association field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemAssociationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemAssociation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of association between the device and the other item**

 This attribute defined the type of association when establishing associations or relations between items, e.g. 'packaged within' or 'used with' or 'to be mixed with.

 */
    #[serde(rename = "associationType")]
    pub association_type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_associationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub association_type_ext: Option<FieldExtension>,
    /** **The related item or product**

 The related item or product.

 */
    #[serde(rename = "relatedItem")]
    pub related_item: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedItem")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_item_ext: Option<FieldExtension>,
    /** **The quantity of the product in this product**

 The quantity of the related product in this product - Numerator is the quantity of the related product. Denominator is the quantity of the present product. For example a value of 20 means that this product contains 20 units of the related product; a value of 1:20 means the inverse - that the contained product contains 20 units of the present product.

 */
    #[serde(rename = "quantity")]
    pub quantity: 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>,
}
#[cfg(feature = "builders")]
impl InventoryItemAssociation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemAssociationBuilder {
        InventoryItemAssociationBuilder::default()
    }
}
/// Sub-fields of the characteristic field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 characteristic that is being defined**

 The type of characteristic that is being defined.

 */
    #[serde(rename = "characteristicType")]
    pub characteristic_type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_characteristicType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub characteristic_type_ext: Option<FieldExtension>,
    /** **The value of the attribute**

 The value of the attribute.

 The string value is used for characteristics that are descriptive and not codeable information. CodeableConcept.text is used when the characteristic is discrete and could otherwise be coded but for which there is no code available. */
    #[serde(flatten)]
    pub value: InventoryItemCharacteristicValue,
    /// 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<InventoryItemCharacteristicValueExtension>,
}
#[cfg(feature = "builders")]
impl InventoryItemCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemCharacteristicBuilder {
        InventoryItemCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in InventoryItemCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InventoryItemCharacteristicValue {
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// 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 Annotation type.
    #[serde(rename = "valueAnnotation")]
    Annotation(Annotation),
    /// Variant accepting the Address type.
    #[serde(rename = "valueAddress")]
    Address(Address),
    /// Variant accepting the Duration type.
    #[serde(rename = "valueDuration")]
    Duration(Duration),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for InventoryItemCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InventoryItemCharacteristicValueExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(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 Annotation extension.
    #[serde(rename = "_valueAnnotation")]
    Annotation(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_valueAddress")]
    Address(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_valueDuration")]
    Duration(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the instance field in InventoryItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryItemInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryItemInstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 physical instance, typically a serial number**

 The identifier for the physical instance, typically a serial 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>>,
    /** **The lot or batch number of the item**

 The lot or batch number of the item.

 */
    #[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>,
    /** **The expiry date or date and time for the product**

 The expiry date or date and time for the product.

 */
    #[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>,
    /** **The subject that the item is associated with**

 The subject that the item is associated with.

 */
    #[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 location that the item is associated with**

 The location that the item is associated with.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl InventoryItemInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryItemInstanceBuilder {
        InventoryItemInstanceBuilder::default()
    }
}
/** A report of inventory or stock items.

 **[InventoryReport](http://hl7.org/fhir/StructureDefinition/InventoryReport) v5.0.0**

 A report of inventory or stock items

 A report of inventory or stock items.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct InventoryReport(pub Box<InventoryReportInner>);
/** A report of inventory or stock items.

 **[InventoryReport](http://hl7.org/fhir/StructureDefinition/InventoryReport) v5.0.0**

 A report of inventory or stock items

 A report of inventory or stock items.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryReportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct InventoryReportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "InventoryReport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::InventoryReport", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 report**

 Business identifier for the InventoryReport.

 */
    #[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>>,
    /** **[InventoryReportStatus](http://hl7.org/fhir/ValueSet/inventoryreport-status); draft | requested | active | entered-in-error**

 The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.

 */
    #[serde(rename = "status")]
    pub status: codes::InventoryReportStatus,
    /// 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>,
    /** **[InventoryCountType](http://hl7.org/fhir/ValueSet/inventoryreport-counttype); snapshot | difference**

 Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).

 */
    #[serde(rename = "countType")]
    pub count_type: codes::InventoryCountType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_countType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub count_type_ext: Option<FieldExtension>,
    /** **addition | subtraction**

 What type of operation is being performed - addition or subtraction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationType")]
    pub operation_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_type_ext: Option<FieldExtension>,
    /** **The reason for this count - regular count, ad-hoc count, new arrivals, etc**

 The reason for this count - regular count, ad-hoc count, new arrivals, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationTypeReason")]
    pub operation_type_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operationTypeReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_type_reason_ext: Option<FieldExtension>,
    /** **When the report has been submitted**

 When the report has been submitted.

 */
    #[serde(rename = "reportedDateTime")]
    pub reported_date_time: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reportedDateTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reported_date_time_ext: Option<FieldExtension>,
    /** **Who submits the report**

 Who submits the report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reporter")]
    pub reporter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reporter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporter_ext: Option<FieldExtension>,
    /** **The period the report refers to**

 The period the report refers to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reportingPeriod")]
    pub reporting_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reportingPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporting_period_ext: Option<FieldExtension>,
    /** **An inventory listing section (grouped by any of the attributes)**

 An inventory listing section (grouped by any of the attributes).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inventoryListing")]
    pub inventory_listing: Vec<Option<InventoryReportInventoryListing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_inventoryListing")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub inventory_listing_ext: Vec<Option<FieldExtension>>,
    /** **A note associated with the InventoryReport**

 A note associated with the InventoryReport.

 */
    #[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 InventoryReportBuilder {
    #[doc = concat!("Finalize building ", "InventoryReport", ".")]
    pub fn build(self) -> Result<InventoryReport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<InventoryReportInner> for InventoryReport {
    fn from(inner: InventoryReportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for InventoryReport {
    type Target = InventoryReportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for InventoryReport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl InventoryReport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> InventoryReportBuilder {
        InventoryReportBuilder::default()
    }
}
impl InventoryReport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::InventoryReport
    }
}
/// Sub-fields of the inventoryListing field in InventoryReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryReportInventoryListingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryReportInventoryListing {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the inventory items**

 Location of the inventory items.

 */
    #[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>,
    /** **The status of the items that are being reported**

 The status of the items.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "itemStatus")]
    pub item_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_itemStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_status_ext: Option<FieldExtension>,
    /** **The date and time when the items were counted**

 The date and time when the items were counted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "countingDateTime")]
    pub counting_date_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_countingDateTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub counting_date_time_ext: Option<FieldExtension>,
    /** **The item or items in this listing**

 The item or items in this listing.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<InventoryReportInventoryListingItem>>,
    /// 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 InventoryReportInventoryListing {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryReportInventoryListingBuilder {
        InventoryReportInventoryListingBuilder::default()
    }
}
/// Sub-fields of the item field in InventoryReportInventoryListing
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InventoryReportInventoryListingItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InventoryReportInventoryListingItem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 inventory category or classification of the items being reported**

 The inventory category or classification of the items being reported. This is meant not for defining the product, but for inventory categories e.g. 'pending recount' or 'damaged'.

 */
    #[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>,
    /** **The quantity of the item or items being reported**

 The quantity of the item or items being reported.

 */
    #[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>,
    /** **The code or reference to the item type**

 The code or reference to the item type.

 */
    #[serde(rename = "item")]
    pub item: CodeableReference,
    /// 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 InventoryReportInventoryListingItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InventoryReportInventoryListingItemBuilder {
        InventoryReportInventoryListingItemBuilder::default()
    }
}
/** Invoice containing collected ChargeItems from an Account with calculated individual and total price for Billing purpose.

 **[Invoice](http://hl7.org/fhir/StructureDefinition/Invoice) v5.0.0**

 Invoice containing ChargeItems from an Account

 Invoice containing collected ChargeItems from an Account with calculated individual and total price for Billing purpose.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Invoice(pub Box<InvoiceInner>);
/** Invoice containing collected ChargeItems from an Account with calculated individual and total price for Billing purpose.

 **[Invoice](http://hl7.org/fhir/StructureDefinition/Invoice) v5.0.0**

 Invoice containing ChargeItems from an Account

 Invoice containing collected ChargeItems from an Account with calculated individual and total price for Billing purpose.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InvoiceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct InvoiceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Invoice::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Invoice", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Identifier of this Invoice, often used for reference in correspondence about this invoice or for tracking of payments.

 */
    #[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>>,
    /** **[InvoiceStatus](http://hl7.org/fhir/ValueSet/invoice-status); draft | issued | balanced | cancelled | entered-in-error**

 The current state of the Invoice.

 */
    #[serde(rename = "status")]
    pub status: codes::InvoiceStatus,
    /// 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 cancellation of this Invoice**

 In case of Invoice cancellation a reason must be given (entered in error, superseded by corrected invoice etc.).

 Derived Profiles may choose 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 = "cancelledReason")]
    pub cancelled_reason: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cancelledReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cancelled_reason_ext: Option<FieldExtension>,
    /** **Type of Invoice**

 Type of Invoice depending on domain, realm an usage (e.g. internal/external, dental, preliminary).

 */
    #[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>,
    /** **Recipient(s) of goods and services**

 The individual or set of individuals receiving the goods and services billed in this invoice.

 */
    #[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>,
    /** **Recipient of this invoice**

 The individual or Organization responsible for balancing of this invoice.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recipient_ext: Option<FieldExtension>,
    /** **DEPRICATED**

 Depricared by the element below.

 */
    #[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>,
    /** **When posted**

 Date/time(s) of when this Invoice was posted.

 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(rename = "creation")]
    pub creation: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_creation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub creation_ext: Option<FieldExtension>,
    /** **Billing date or period**

 Date/time(s) range of services included in this invoice.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub period: Option<InvoicePeriod>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<InvoicePeriodExtension>,
    /** **Participant in creation of this Invoice**

 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<InvoiceParticipant>>,
    /// 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>>,
    /** **Issuing Organization of Invoice**

 The organizationissuing the Invoice.

 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 = "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>,
    /** **Account that is being balanced**

 Account which is supposed to be balanced with this Invoice.

 Systems posting the ChargeItems might 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 = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "account")]
    pub account: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub account_ext: Option<FieldExtension>,
    /** **Line items of this Invoice**

 Each line item represents one charge for goods and services rendered. Details such.ofType(date), code and amount are found in the referenced ChargeItem resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lineItem")]
    pub line_item: Vec<Option<InvoiceLineItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_lineItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub line_item_ext: Vec<Option<FieldExtension>>,
    /** **Components of Invoice total**

 The total amount for the Invoice may be calculated as the sum of the line items with surcharges/deductions that apply in certain conditions.  The priceComponent element can be used to offer transparency to the recipient of the Invoice of how the total price was calculated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalPriceComponent")]
    pub total_price_component: Vec<Option<MonetaryComponent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_totalPriceComponent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub total_price_component_ext: Vec<Option<FieldExtension>>,
    /** **Net total of this Invoice**

 Invoice total , taxes excluded.

 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 overridden. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalNet")]
    pub total_net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalNet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_net_ext: Option<FieldExtension>,
    /** **Gross total of this Invoice**

 Invoice total, tax included.

 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 overridden. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalGross")]
    pub total_gross: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalGross")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_gross_ext: Option<FieldExtension>,
    /** **Payment details**

 Payment details such as banking details, period of payment, deductibles, methods of payment.

 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 = "paymentTerms")]
    pub payment_terms: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentTerms")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_terms_ext: Option<FieldExtension>,
    /** **Comments made about the invoice**

 Comments made about the invoice by the issuer, 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 InvoiceBuilder {
    #[doc = concat!("Finalize building ", "Invoice", ".")]
    pub fn build(self) -> Result<Invoice, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<InvoiceInner> for Invoice {
    fn from(inner: InvoiceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Invoice {
    type Target = InvoiceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Invoice {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Invoice {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> InvoiceBuilder {
        InvoiceBuilder::default()
    }
}
impl Invoice {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Invoice
    }
}
/// Choice of types for the period[x] field in Invoice
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoicePeriod {
    /// Variant accepting the Date type.
    #[serde(rename = "periodDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "periodPeriod")]
    Period(Period),
}
/// Extension value for InvoicePeriod.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoicePeriodExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_periodDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_periodPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the participant field in Invoice
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InvoiceParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InvoiceParticipant {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of involvement in creation of this Invoice**

 Describes the type of involvement (e.g. transcriptionist, creator etc.). If the invoice has been created automatically, the Participant may be a billing engine or another kind of device.

 */
    #[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 involved**

 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 InvoiceParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InvoiceParticipantBuilder {
        InvoiceParticipantBuilder::default()
    }
}
/// Sub-fields of the lineItem field in Invoice
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "InvoiceLineItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct InvoiceLineItem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of line item**

 Sequence in which the items appear on the invoice.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequence")]
    pub sequence: Option<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>,
    /** **Service data or period**

 Date/time(s) range when this service was delivered or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub serviced: Option<InvoiceLineItemServiced>,
    /// 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<InvoiceLineItemServicedExtension>,
    /** **Reference to ChargeItem containing details of this line item or an inline billing code**

 The ChargeItem contains information such as the billing code, date, amount etc. If no further details are required for the lineItem, inline billing codes can be added using the CodeableConcept data type instead of the Reference.

 */
    #[serde(flatten)]
    pub charge_item: InvoiceLineItemChargeItem,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub charge_item_ext: Option<InvoiceLineItemChargeItemExtension>,
    /** **Components of total line item price**

 The price for a ChargeItem may be calculated as a base price with surcharges/deductions that apply in certain conditions. A ChargeItemDefinition resource that defines the prices, factors and conditions that apply to a billing code is currently under development. The priceComponent element can be used to offer transparency to the recipient of the Invoice as to how the prices have been calculated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priceComponent")]
    pub price_component: Vec<Option<MonetaryComponent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_priceComponent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub price_component_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl InvoiceLineItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> InvoiceLineItemBuilder {
        InvoiceLineItemBuilder::default()
    }
}
/// Choice of types for the serviced[x] field in InvoiceLineItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoiceLineItemServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for InvoiceLineItemServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoiceLineItemServicedExtension {
    /// 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 chargeItem[x] field in InvoiceLineItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoiceLineItemChargeItem {
    /// Variant accepting the Reference type.
    #[serde(rename = "chargeItemReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "chargeItemCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for InvoiceLineItemChargeItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum InvoiceLineItemChargeItemExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_chargeItemReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_chargeItemCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** 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.

 **[Library](http://hl7.org/fhir/StructureDefinition/Library) v5.0.0**

 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>);
/** 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.

 **[Library](http://hl7.org/fhir/StructureDefinition/Library) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this library, represented as a URI (globally unique)**

 An absolute URI that is used to identify this library when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this library is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the library is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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 reference to a particular business version of the library with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<LibraryVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<LibraryVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Subordinate title of the library**

 An explanatory or alternate title for the library giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_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 libraries that are appropriate for use vs. not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 librarys that are appropriate for use versus not. */
    #[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>,
    /** **Type of individual the library content is focused on**

 A code or group definition that describes the intended subject of the contents of the library.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<LibrarySubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<LibrarySubjectExtension>,
    /** **Date last changed**

 The date  (and optionally time) when the library was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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>,
    /** **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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 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 library is presumed to be the predominant language in the place the library 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate library instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 library is defined**

 Explanation 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>,
    /** **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.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 library intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[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.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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
    }
}
/// Choice of types for the versionAlgorithm[x] field in Library
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum LibraryVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for LibraryVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum LibraryVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in Library
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum LibrarySubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
}
/// Extension value for LibrarySubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum LibrarySubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
}
/** Identifies two or more records (resource instances) that refer to the same real-world "occurrence".

 **[Linkage](http://hl7.org/fhir/StructureDefinition/Linkage) v5.0.0**

 Links records for 'same' item

 Identifies two or more records (resource instances) that refer to the same real-world "occurrence".

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Linkage(pub Box<LinkageInner>);
/** Identifies two or more records (resource instances) that refer to the same real-world "occurrence".

 **[Linkage](http://hl7.org/fhir/StructureDefinition/Linkage) v5.0.0**

 Links records for 'same' item

 Identifies two or more records (resource instances) that refer 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.

 */
    #[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 which record considered as the reference to the same real-world occurrence as well as how the items should 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** A List is a curated collection of resources, for things such as problem lists, allergy lists, facility list, organization list, etc.

 **[List](http://hl7.org/fhir/StructureDefinition/List) v5.0.0**

 A list is a curated collection of resources

 A List is a curated collection of resources, for things such as problem lists, allergy lists, facility list, organization list, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct List(pub Box<ListInner>);
/** A List is a curated collection of resources, for things such as problem lists, allergy lists, facility list, organization list, etc.

 **[List](http://hl7.org/fhir/StructureDefinition/List) v5.0.0**

 A list is a curated collection of resources

 A List is a curated collection of resources, for things such as problem lists, allergy lists, facility list, organization list, 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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 misunderstood 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(s)**

 The common subject(s) (or patient(s)) of the resources that are in the list if there is one (or a set of subjects).

 Some purely arbitrary lists do not have a common subject, so this is optional. Lists having multiple subjects may raise challenges for systems that base access control or other security considerations on linkages to 'subject'. E.g. if a List is associated with multiple Patient subjects, then it would be nominally part of multiple patient compartments, which might drive access rights. */
    #[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 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**

 Date list was last reviewed/revised and determined to be 'current'.

 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 */
    #[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. 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.

 */
    #[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()
    }
}
/** Details and position information for a place where services are provided and resources and participants may be stored, found, contained, or accommodated.

 **[Location](http://hl7.org/fhir/StructureDefinition/Location) v5.0.0**

 Details and position information for a place

 Details and position information for a 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>);
/** Details and position information for a place where services are provided and resources and participants may be stored, found, contained, or accommodated.

 **[Location](http://hl7.org/fhir/StructureDefinition/Location) v5.0.0**

 Details and position information for a place

 Details and position information for a 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 */
    #[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://terminology.hl7.org/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/chairs/etc. such as an isolation unit/dialysis 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 a 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 modifier 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://terminology.hl7.org/ValueSet/v3-ServiceDeliveryLocationRoleType); Type of function performed**

 Indicates the type of function performed at the location.

 */
    #[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>>,
    /** **Official contact details for the location**

 The contact details of communication devices available at the location. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.

 The address/telecom use code 'home' are not to be used. Note that these contacts are not the contact details of people who provide the service (that would be through PractitionerRole), these are official contacts for the Healthcare itself for specific purposes. E.g. Mailing Addresses, Billing Addresses, Contact numbers for Booking or Billing Enquiries, general web address, web address for online bookings etc.

If this is empty (or the type of interest is empty), refer to the organization's contacts. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ExtendedContactDetail>>,
    /// 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>>,
    /** **Physical location**

 Physical location.

 Additional addresses should be recorded using another instance of the Location resource, or via the Organization. */
    #[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>,
    /** **[LocationForm](http://hl7.org/fhir/ValueSet/location-form); Physical form of the location**

 Physical form of the location, e.g. building, room, vehicle, road, virtual.

 */
    #[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>,
    /** **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).

 To define a boundary shape for this location use the standard extension `[http://hl7.org/fhir/StructureDefinition/location-boundary-geojson](http://hl7.org/fhir/extensions/StructureDefinition-location-boundary-geojson.html)`, and search using the `contains` special search parameter. */
    #[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 a part of**

 Another Location of which this Location is physically a 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>,
    /** **[LocationCharacteristic](http://hl7.org/fhir/ValueSet/location-characteristic); 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>>,
    /** **What days/times during a week is this location usually open (including exceptions)**

 What days/times during a week is this location usually open, and any exceptions where the location is not available.

 This type of information is commonly found published in directories and on websites informing customers when the facility is available.

Specific services within the location may have their own hours which could be shorter (or longer) than the locations hours.

Systems may choose to render availability differently than it is exchanged on the interface. For example, rather than "Mon, Tue, Wed, Thur, Fri from 9am-12am; Mon, Tue, Wed, Thur, Fri from 1pm-5pm" as would be implied by two availableTime repetitions, an application could render this information as "Mon-Fri 9-12am and 1-5pm".

The availableStartTime is the opening time, and the availableEndTime is the closing time. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hoursOfOperation")]
    pub hours_of_operation: Vec<Option<Availability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_hoursOfOperation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub hours_of_operation_ext: Vec<Option<FieldExtension>>,
    /** **Connection details of a virtual service (e.g. conference call)**

 Connection details of a virtual service (e.g. shared conference call facility with dedicated number/details).

 There are two types of virtual meetings that often exist:

* a persistent, virtual meeting room that can only be used for a single purpose at a time,
 * and a dynamic virtual meeting room that is generated on demand for a specific purpose.

 Implementers may consider using Appointment.virtualService for virtual meeting rooms that are generated on-demand. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "virtualService")]
    pub virtual_service: Vec<Option<VirtualServiceDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_virtualService")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub virtual_service_ext: Vec<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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 on Location main page).

 */
    #[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 on Location main page).

 */
    #[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 on Location main page).

 */
    #[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()
    }
}
/** The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product.

 **[ManufacturedItemDefinition](http://hl7.org/fhir/StructureDefinition/ManufacturedItemDefinition) v5.0.0**

 The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product

 The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ManufacturedItemDefinition(pub Box<ManufacturedItemDefinitionInner>);
/** The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product.

 **[ManufacturedItemDefinition](http://hl7.org/fhir/StructureDefinition/ManufacturedItemDefinition) v5.0.0**

 The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product

 The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ManufacturedItemDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ManufacturedItemDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ManufacturedItemDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ManufacturedItemDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 */
    #[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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this item. Enables tracking the life-cycle of the content.

 Allows filtering of manufactured items that are appropriate for use versus not. */
    #[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>,
    /** **A descriptive name applied to this item**

 A descriptive name applied to this item.

 */
    #[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>,
    /** **[ManufacturedDoseForm](http://hl7.org/fhir/ValueSet/manufactured-dose-form); Dose form as manufactured (before any necessary transformation)**

 Dose form as manufactured and before any transformation into the pharmaceutical product.

 */
    #[serde(rename = "manufacturedDoseForm")]
    pub manufactured_dose_form: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manufacturedDoseForm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manufactured_dose_form_ext: Option<FieldExtension>,
    /** **[UnitOfPresentation](http://hl7.org/fhir/ValueSet/unit-of-presentation); The “real-world” units in which the quantity of the item is described**

 The “real-world” units in which the quantity of the manufactured item is described.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitOfPresentation")]
    pub unit_of_presentation: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitOfPresentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_of_presentation_ext: Option<FieldExtension>,
    /** **Manufacturer of the item, one of several possible**

 Manufacturer of the item, one of several possible.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated**

 Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "marketingStatus")]
    pub marketing_status: Vec<Option<MarketingStatus>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_marketingStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub marketing_status_ext: Vec<Option<FieldExtension>>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); The ingredients of this manufactured item. Only needed if these are not specified by incoming references from the Ingredient resource**

 The ingredients of this manufactured item. This is only needed if the ingredients are not specified by incoming references from the Ingredient resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **General characteristics of this item**

 General characteristics of this item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<ManufacturedItemDefinitionProperty>>,
    /// 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>>,
    /** **Physical parts of the manufactured item, that it is intrisically made from. This is distinct from the ingredients that are part of its chemical makeup**

 Physical parts of the manufactured item, that it is intrisically made from. This is distinct from the ingredients that are part of its chemical makeup.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<ManufacturedItemDefinitionComponent>>,
    /// 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 ManufacturedItemDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ManufacturedItemDefinition", ".")]
    pub fn build(
        self,
    ) -> Result<ManufacturedItemDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ManufacturedItemDefinitionInner> for ManufacturedItemDefinition {
    fn from(inner: ManufacturedItemDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ManufacturedItemDefinition {
    type Target = ManufacturedItemDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ManufacturedItemDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ManufacturedItemDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ManufacturedItemDefinitionBuilder {
        ManufacturedItemDefinitionBuilder::default()
    }
}
impl ManufacturedItemDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ManufacturedItemDefinition
    }
}
/// Sub-fields of the property field in ManufacturedItemDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ManufacturedItemDefinitionPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ManufacturedItemDefinitionProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SNOMEDCTCharacteristicCodes](http://hl7.org/fhir/ValueSet/product-characteristic-codes); A code expressing the type of characteristic**

 A code expressing the type of characteristic.

 */
    #[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>,
    /** **A value for the characteristic**

 A value for the characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ManufacturedItemDefinitionPropertyValue>,
    /// 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<ManufacturedItemDefinitionPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl ManufacturedItemDefinitionProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ManufacturedItemDefinitionPropertyBuilder {
        ManufacturedItemDefinitionPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in ManufacturedItemDefinitionProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ManufacturedItemDefinitionPropertyValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for ManufacturedItemDefinitionPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ManufacturedItemDefinitionPropertyValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(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 component field in ManufacturedItemDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ManufacturedItemDefinitionComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ManufacturedItemDefinitionComponent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Defining type of the component e.g. shell, layer, ink**

 Defining type of the component e.g. shell, layer, ink.

 */
    #[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>,
    /** **The function of this component within the item e.g. delivers active ingredient, masks taste**

 The function of this component within the item e.g. delivers active ingredient, masks taste.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub function_ext: Vec<Option<FieldExtension>>,
    /** **The measurable amount of total quantity of all substances in the component, expressable in different ways (e.g. by mass or volume)**

 The measurable amount of total quantity of all substances in the component, expressable in different ways (e.g. by mass or volume).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub amount_ext: Vec<Option<FieldExtension>>,
    /** **A reference to a constituent of the manufactured item as a whole, linked here so that its component location within the item can be indicated. This not where the item's ingredient are primarily stated (for which see Ingredient.for or ManufacturedItemDefinition.ingredient)**

 A reference to a constituent of the manufactured item as a whole, linked here so that its component location within the item can be indicated. This not where the item's ingredient are primarily stated (for which see Ingredient.for or ManufacturedItemDefinition.ingredient).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "constituent")]
    pub constituent: Vec<Option<ManufacturedItemDefinitionComponentConstituent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_constituent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub constituent_ext: Vec<Option<FieldExtension>>,
    /** **General characteristics of this component**

 General characteristics of this component.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<ManufacturedItemDefinitionProperty>>,
    /// 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>>,
    /** **A component that this component contains or is made from**

 A component that this component contains or is made from.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<ManufacturedItemDefinitionComponent>>,
    /// 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 ManufacturedItemDefinitionComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ManufacturedItemDefinitionComponentBuilder {
        ManufacturedItemDefinitionComponentBuilder::default()
    }
}
/// Sub-fields of the constituent field in ManufacturedItemDefinitionComponent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ManufacturedItemDefinitionComponentConstituentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ManufacturedItemDefinitionComponentConstituent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 measurable amount of the substance, expressable in different ways (e.g. by mass or volume)**

 The measurable amount of the substance, expressable in different ways (e.g. by mass or volume).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub amount_ext: Vec<Option<FieldExtension>>,
    /** **The physical location of the constituent/ingredient within the component**

 The physical location of the constituent/ingredient within the component. Example – if the component is the bead in the capsule, then the location would be where the ingredient resides within the product part – intragranular, extra-granular, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<CodeableConcept>>,
    /// 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 function of this constituent within the component e.g. binder**

 The function of this constituent within the component e.g. binder.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub function_ext: Vec<Option<FieldExtension>>,
    /** **The ingredient that is the constituent of the given component**

 The ingredient that is the constituent of the given component.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasIngredient")]
    pub has_ingredient: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_hasIngredient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub has_ingredient_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ManufacturedItemDefinitionComponentConstituent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ManufacturedItemDefinitionComponentConstituentBuilder {
        ManufacturedItemDefinitionComponentConstituentBuilder::default()
    }
}
/** The Measure resource provides the definition of a quality measure.

 **[Measure](http://hl7.org/fhir/StructureDefinition/Measure) v5.0.0**

 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>);
/** The Measure resource provides the definition of a quality measure.

 **[Measure](http://hl7.org/fhir/StructureDefinition/Measure) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this measure, represented as a URI (globally unique)**

 An absolute URI that is used to identify this measure when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this measure is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the measure is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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 reference to a particular business version of the measure with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<MeasureVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<MeasureVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Subordinate title of the measure**

 An explanatory or alternate title for the measure giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 measures that are appropriate for use versus not. */
    #[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>,
    /** **E.g. Patient, Practitioner, RelatedPerson, Organization, Location, Device**

 The intended subjects for the measure. If this element is not provided, a Patient subject is assumed, but the subject of the measure can be anything.

 The subject of the measure is critical in interpreting the criteria definitions, as the logic in the measures is evaluated with respect to a particular subject. This corresponds roughly to the notion of a Compartment in that it limits what content is available based on its relationship to the subject. In CQL, this corresponds to the context declaration. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<MeasureSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<MeasureSubjectExtension>,
    /** **[BasisType](http://hl7.org/fhir/ValueSet/fhir-types); Population basis**

 The population basis specifies the type of elements in the population. For a subject-based measure, this is boolean (because the subject and the population basis are the same, and the population criteria define yes/no values for each individual in the population). For measures that have a population basis that is different than the subject, this element specifies the type of the population basis. For example, an encounter-based measure has a subject of Patient and a population basis of Encounter, and the population criteria all return lists of Encounters.

 For a subject-based measure, the population basis is simply boolean; all the criteria are expressed as true/false conditions that determine membership of an individual case in the population. For non-subject-based measures, the population basis can be any resource type, and the criteria are queries that return the subject's contribution to the population as a list of that resource type. For example, for a procedure-based measure, the population criteria would return lists of procedures that should be included in each population. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Option<codes::FHIRTypes>,
    /// 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>,
    /** **Date last changed**

 The date  (and optionally time) when the measure was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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>,
    /** **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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 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 measure is presumed to be the predominant language in the place the measure 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate measure instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 measure is defined**

 Explanation 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, from a clinical perspective, of how the measure is used.

 This metadata element was typically referred to as Guidance in HQMF */
    #[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>,
    /** **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.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); The category of the measure, such as Education, Treatment, Assessment, etc**

 Descriptive topics related to the content of the measure. Topics provide a high-level categorization grouping types of measures that can be useful for filtering and searching.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<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<String>>,
    /// 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://terminology.hl7.org/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>,
    /** **[MeasureScoringUnit](http://hl7.org/fhir/ValueSet/measure-scoring-unit); What units?**

 Defines the expected units of measure for the measure score. This element SHOULD be specified as a UCUM unit.

 When this element is specified, implementations are expected to report measure scores in the specified units. Note that this may involve unit conversion if the expected units are different than the units of the resulting score calculation. In this case, unit conversions SHALL be performed according to the unit conversion semantics specified by UCUM. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scoringUnit")]
    pub scoring_unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scoringUnit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scoring_unit_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 risk adjustment is 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 a measure is subject to the statistical process for reducing, removing, or clarifying the influences of confounding factors to allow for 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>,
    /** **Detailed description of why the measure exists**

 Provides a succinct 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>,
    /** **[MeasureImprovementNotation](http://hl7.org/fhir/ValueSet/measure-improvement-notation); increase | decrease**

 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 within 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<CodeableConcept>,
    /// 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 = "term")]
    pub term: Vec<Option<MeasureTerm>>,
    /// 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>>,
    /** **Additional guidance for implementers (deprecated)**

 Additional guidance for the measure including how it can be used in a clinical context, and the intent of the measure.

 NOTE: This element is deprecated in favor of the usage element */
    #[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>,
    /** **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 resources for each patient and referenced in the supplementalData element of the MeasureReport. If the supplementalData expression results in a value other than a resource, it is reported using an Observation resource, typically contained in the resulting MeasureReport. See the MeasureReport resource and 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in Measure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for MeasureVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in Measure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
}
/// Extension value for MeasureSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the term 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 = "MeasureTermBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureTerm {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DefinitionCode](http://hl7.org/fhir/ValueSet/measure-definition-example); What term?**

 A codeable representation of the defined term.

 */
    #[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>,
    /** **Meaning of the term**

 Provides a definition for the term as used within the measure.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MeasureTerm {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureTermBuilder {
        MeasureTermBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 group in measure**

 An identifier that is unique within the Measure allowing linkage to the equivalent item in a MeasureReport 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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureGroupExample](http://hl7.org/fhir/ValueSet/measure-group-example); Meaning of the group**

 Indicates a meaning for the group. This can be as simple as a unique identifier, or it can establish meaning in a broader context by drawing from a terminology, allowing groups to be correlated across measures.

 */
    #[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>,
    /** **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>,
    /** **[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.

 When specified at the group level, defines the measure type for this specific group. If not specified, the measureType of the group is determined by the root type element */
    #[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>>,
    /** **E.g. Patient, Practitioner, RelatedPerson, Organization, Location, Device**

 The intended subjects for the measure. If this element is not provided, a Patient subject is assumed, but the subject of the measure can be anything.

 The subject of the measure is critical in interpreting the criteria definitions, as the logic in the measures is evaluated with respect to a particular subject. This corresponds roughly to the notion of a Compartment in that it limits what content is available based on its relationship to the subject. In CQL, this corresponds to the context declaration. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<MeasureGroupSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<MeasureGroupSubjectExtension>,
    /** **[BasisType](http://hl7.org/fhir/ValueSet/fhir-types); Population basis**

 The population basis specifies the type of elements in the population. For a subject-based measure, this is boolean (because the subject and the population basis are the same, and the population criteria define yes/no values for each individual in the population). For measures that have a population basis that is different than the subject, this element specifies the type of the population basis. For example, an encounter-based measure has a subject of Patient and a population basis of Encounter, and the population criteria all return lists of Encounters.

 When specified at the group level, defines the population basis for this specific group. If not specified, the basis for the group is determined by the root basis element */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Option<codes::FHIRTypes>,
    /// 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>,
    /** **[MeasureScoring](http://terminology.hl7.org/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.

 When specified at the group level, defines the scoring for this specific group. If not specified, scoring for this group is determined by the root scoring element */
    #[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>,
    /** **[MeasureScoringUnit](http://hl7.org/fhir/ValueSet/measure-scoring-unit); What units?**

 Defines the expected units of measure for the measure score. This element SHOULD be specified as a UCUM unit.

 When specified at the group level, this defines the scoringUnit for this specific group. If not specified, the scoringUnit for this group is determined by the root scoringUnit element. As with the root element, when this element is specified, implementations are expected to report measure scores in the specified units. Note that this may involve unit conversion if the expected units are different than the units of the resulting score calculation. In this case, unit conversions SHALL be performed according to the unit conversion semantics specified by UCUM. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scoringUnit")]
    pub scoring_unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scoringUnit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scoring_unit_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>,
    /** **[MeasureImprovementNotation](http://hl7.org/fhir/ValueSet/measure-improvement-notation); increase | decrease**

 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 within a range).

 When specified at the group level, this element defines the improvementNotation for this specific group. If not specified, improvementNotation for this group is determined by the root improvementNotation element */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "improvementNotation")]
    pub improvement_notation: Option<CodeableConcept>,
    /// 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>,
    /** **Logic used by the measure group**

 A reference to a Library resource containing the formal logic used by the measure group.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "library")]
    pub library: Vec<Option<String>>,
    /// 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>>,
    /** **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()
    }
}
/// Choice of types for the subject[x] field in MeasureGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureGroupSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
}
/// Extension value for MeasureGroupSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureGroupSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 population in measure**

 An identifier that is unique within the Measure allowing linkage to the equivalent population in a MeasureReport 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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[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>,
    /** **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 criteria that defines this population**

 An expression that specifies the criteria for the population, typically the name of an expression in a library.

 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(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criteria")]
    pub criteria: Option<Expression>,
    /// 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>,
    /** **A group resource that defines this population**

 A Group resource that defines this population as a set of characteristics.

 Note that this approach can only be used for measures where the basis is of the same type as the populations (e.g. a Patient-based measure, rather than an Encounter-based measure). In addition, the referenced Group resource SHALL be a definitional (as opposed to an actual) group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupDefinition")]
    pub group_definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_definition_ext: Option<FieldExtension>,
    /** **Which population**

 The id of a population element in this measure that provides the input for this population criteria. In most cases, the scoring structure of the measure implies specific relationships (e.g. the Numerator uses the Denominator as the source in a proportion scoring). In some cases, however, multiple possible choices exist and must be resolved explicitly. For example in a ratio measure with multiple initial populations, the denominator must specify which population should be used as the starting point.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inputPopulationId")]
    pub input_population_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inputPopulationId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub input_population_id_ext: Option<FieldExtension>,
    /** **[MeasureAggregateMethod](http://hl7.org/fhir/ValueSet/measure-aggregate-method); Aggregation method for a measure score (e.g. sum, average, median, minimum, maximum, count)**

 Specifies which method should be used to aggregate measure observation values. For most scoring types, this is implied by scoring (e.g. a proportion measure counts members of the populations). For continuous variables, however, this information must be specified to ensure correct calculation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "aggregateMethod")]
    pub aggregate_method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_aggregateMethod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub aggregate_method_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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 stratifier in measure**

 An identifier that is unique within the Measure allowing linkage to the equivalent item in a MeasureReport 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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureStratifierExample](http://hl7.org/fhir/ValueSet/measure-stratifier-example); Meaning of the stratifier**

 Indicates a meaning for the stratifier. This can be as simple as a unique identifier, or it can establish meaning in a broader context by drawing from a terminology, allowing stratifiers to be correlated across measures.

 */
    #[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>,
    /** **The human readable description of this stratifier**

 The human readable description of this stratifier 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>,
    /** **How the measure should be stratified**

 An expression that specifies the criteria for the stratifier. This is typically the name of an expression defined within a referenced library, but it may also be a path to a stratifier element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criteria")]
    pub criteria: Option<Expression>,
    /// 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>,
    /** **A group resource that defines this population**

 A Group resource that defines this population as a set of characteristics.

 Note that this approach can only be used for measures where the basis is of the same type as the populations (e.g. a Patient-based measure, rather than an Encounter-based measure). In addition, the referenced Group SHALL be a definitional (as opposed to an actual) group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupDefinition")]
    pub group_definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_definition_ext: Option<FieldExtension>,
    /** **Stratifier criteria component for the measure**

 A component of 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.

 Stratifiers are defined either as a single criteria, or as a set of component criteria. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<MeasureGroupStratifierComponent>>,
    /// 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 MeasureGroupStratifier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureGroupStratifierBuilder {
        MeasureGroupStratifierBuilder::default()
    }
}
/// Sub-fields of the component field in MeasureGroupStratifier
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureGroupStratifierComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureGroupStratifierComponent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 stratifier component in measure**

 An identifier that is unique within the Measure allowing linkage to the equivalent item in a MeasureReport 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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureStratifierExample](http://hl7.org/fhir/ValueSet/measure-stratifier-example); Meaning of the stratifier component**

 Indicates a meaning for the stratifier component. This can be as simple as a unique identifier, or it can establish meaning in a broader context by drawing from a terminology, allowing stratifiers to be correlated across measures.

 */
    #[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>,
    /** **The human readable description of this stratifier component**

 The human readable description of this stratifier criteria component.

 */
    #[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>,
    /** **Component of how the measure should be stratified**

 An expression that specifies the criteria for this component of the stratifier. This is typically the name of an expression defined within a referenced library, but it may also be a path to a stratifier element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criteria")]
    pub criteria: Option<Expression>,
    /// 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>,
    /** **A group resource that defines this population**

 A Group resource that defines this population as a set of characteristics.

 Note that this approach can only be used for measures where the basis is of the same type as the populations (e.g. a Patient-based measure, rather than an Encounter-based measure). In addition, the referenced Group SHALL be a definitional (as opposed to an actual) group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupDefinition")]
    pub group_definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_definition_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureGroupStratifierComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureGroupStratifierComponentBuilder {
        MeasureGroupStratifierComponentBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 supplementalData in measure**

 An identifier that is unique within the Measure allowing linkage to the equivalent item in a MeasureReport 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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureSupplementalDataExample](http://hl7.org/fhir/ValueSet/measure-supplemental-data-example); Meaning of the supplemental data**

 Indicates a meaning for the supplemental data. This can be as simple as a unique identifier, or it can establish meaning in a broader context by drawing from a terminology, allowing supplemental data to be correlated across measures.

 */
    #[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>,
    /** **[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>>,
    /** **The human readable description of this supplemental data**

 The human readable description of this supplemental data.

 */
    #[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>,
    /** **Expression describing additional data to be reported**

 The criteria for the supplemental data. This is typically the name of a valid expression defined within a referenced library, but it may also be a path to a specific data element. The criteria defines the data to be returned for this element.

 */
    #[serde(rename = "criteria")]
    pub criteria: Expression,
    /// 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 MeasureSupplementalData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureSupplementalDataBuilder {
        MeasureSupplementalDataBuilder::default()
    }
}
/** The MeasureReport resource contains the results of the calculation of a measure; and optionally a reference to the resources involved in that calculation.

 **[MeasureReport](http://hl7.org/fhir/StructureDefinition/MeasureReport) v5.0.0**

 Results of a measure evaluation

 The MeasureReport resource contains the results of the calculation of a measure; and optionally a reference to the resources involved in that calculation.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MeasureReport(pub Box<MeasureReportInner>);
/** The MeasureReport resource contains the results of the calculation of a measure; and optionally a reference to the resources involved in that calculation.

 **[MeasureReport](http://hl7.org/fhir/StructureDefinition/MeasureReport) v5.0.0**

 Results of a measure evaluation

 The MeasureReport resource contains the results of the calculation of a measure; and optionally a reference to the resources involved in that calculation.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 MeasureReport**

 A formal identifier that is used to identify this MeasureReport 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 = "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>>,
    /** **[MeasureReportStatus](http://hl7.org/fhir/ValueSet/measure-report-status); complete | pending | error**

 The MeasureReport status. No data will be available until the MeasureReport status is complete.

 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::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 | subject-list | summary | data-exchange**

 The type of measure report. This may be an individual report, which provides the score for the measure for an individual member of the population; a subject-listing, which returns the list of members that meet the various criteria in the measure; a summary report, which returns a population count for each of the criteria in the measure; or a data-collection, which enables the MeasureReport to be used to exchange the data-of-interest for a quality measure.

 Data-exchange reports are used only to communicate data-of-interest for a measure. They do not necessarily include all the data for a particular subject or population, but they may. */
    #[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>,
    /** **[SubmitDataUpdateType](http://hl7.org/fhir/ValueSet/submit-data-update-type); incremental | snapshot**

 Indicates whether the data submitted in a data-exchange report represents a snapshot or incremental update. A snapshot update replaces all previously submitted data for the receiver, whereas an incremental update represents only updated and/or changed data and should be applied as a differential update to the existing submitted data for the receiver.

 This element only applies to Data-collection reports used to communicate the data-of-interest for a measure */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataUpdateType")]
    pub data_update_type: Option<codes::SubmitDataUpdateType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dataUpdateType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_update_type_ext: Option<FieldExtension>,
    /** **What measure was calculated**

 A reference to the Measure that was calculated to produce this report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measure")]
    pub measure: Option<String>,
    /// 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 individual(s) the report is for**

 Optional subject identifying the individual or individuals the report is for.

 */
    #[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 measure was calculated**

 The date this measure was calculated.

 */
    #[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**

 The individual or organization that is reporting the data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reporter")]
    pub reporter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reporter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporter_ext: Option<FieldExtension>,
    /** **What vendor prepared the data**

 A reference to the vendor who queried the data, calculated results and/or generated the report. The ‘reporting vendor’ is intended to represent the submitting entity when it is not the same as the reporting entity. This extension is used when the Receiver is interested in getting vendor information in the report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reportingVendor")]
    pub reporting_vendor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reportingVendor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporting_vendor_ext: Option<FieldExtension>,
    /** **Where the reported data is from**

 A reference to the location for which the data is being reported.

 */
    #[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>,
    /** **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>,
    /** **What parameters were provided to the report**

 A reference to a Parameters resource (typically represented using a contained resource) that represents any input parameters that were provided to the operation that generated the report.

 Whenever an operation returns a MeasureReport, the IN parameters from that operation can be returned to the caller of the operation using MeasureReport.inputParameters. Operations include but are not limited to $evaluate-measure, $care-gaps, $data-requirements, and $collect-data. The inputParameters can also be used in a MeasureReport used to define a test case (i.e., not as a result of an operation). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inputParameters")]
    pub input_parameters: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inputParameters")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub input_parameters_ext: Option<FieldExtension>,
    /** **[MeasureScoring](http://terminology.hl7.org/ValueSet/measure-scoring); What scoring method (e.g. proportion, ratio, continuous-variable)**

 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. It is expected to be the same as the scoring element on the referenced Measure.

 */
    #[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>,
    /** **[MeasureImprovementNotation](http://hl7.org/fhir/ValueSet/measure-improvement-notation); increase | decrease**

 Whether improvement in the measure is noted by an increase or decrease in the measure score.

 This element is typically defined by the measure, but reproduced here to ensure the measure score can be interpreted. The element is labeled as a modifier because it changes the interpretation of the reported measure score. Note also that a MeasureReport instance includes the improvementNotation as defined by the Measure being reported. It is duplicated in the MeasureReport because it is a critical aspect of interpreting the measure score but it is not intended to reflect whether the measure report is an increase or decrease. It helps interpret if the measure score is an increase or decrease, I.e., moving in the direction of the desired outcome. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "improvementNotation")]
    pub improvement_notation: Option<CodeableConcept>,
    /// 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>,
    /** **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>>,
    /** **Additional information collected for the report**

 A reference to a Resource that represents additional information collected for the report. If the value of the supplemental data is not a Resource (i.e. evaluating the supplementalData expression for this case in the measure results in a value that is not a FHIR Resource), it is reported as a reference to a contained Observation resource.

 For individual measure reports, the supplementalData elements represent the direct result of evaluating the supplementalData expression for the subject of the report. For summary reports, supplementalData is reported as references to contained Observation resources that represent the number of times each value appeared as a supplementalData result for members of the population. */
    #[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<Reference>>,
    /// 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>>,
    /** **What data was used to calculate the measure score**

 Evaluated resources are used to capture what data was involved in the calculation of a measure. This usage is only allowed for individual reports to ensure that the size of the MeasureReport resource is bounded.

 Evaluated resources are only reported for individual reports. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evaluatedResource")]
    pub evaluated_resource: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_evaluatedResource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub evaluated_resource_ext: Vec<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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 group from Measure**

 The group from the Measure that corresponds to this group in the MeasureReport resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureGroupExample](http://hl7.org/fhir/ValueSet/measure-group-example); Meaning of the group**

 The meaning of the population group 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 = "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>,
    /** **What individual(s) the report is for**

 Optional subject identifying the individual or individuals the report is for.

 */
    #[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 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(flatten)]
    pub measure_score: Option<MeasureReportGroupMeasureScore>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_score_ext: Option<MeasureReportGroupMeasureScoreExtension>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 population from Measure**

 The population from the Measure that corresponds to this population in the MeasureReport resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasurePopulation](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 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 subject-list reports, the subject results in this population**

 This element refers to a List of individual level MeasureReport resources, one for each subject in this population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectResults")]
    pub subject_results: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjectResults")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_results_ext: Option<FieldExtension>,
    /** **For subject-list reports, a subject result in this population**

 A reference to an individual level MeasureReport resource for a member of the population.

 This element SHALL NOT be used in with subjectResults, either systems provide results as a List of MeasureReport, or as references to individual MeasureReports. Note that using this element introduces a constraint on the size of the subject-list MeasureReport; implementations would be free to return a TOO-COSTLY response if a request is made for a subject-list report with too many subjects. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectReport")]
    pub subject_report: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subjectReport")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subject_report_ext: Vec<Option<FieldExtension>>,
    /** **What individual(s) in the population**

 Optional Group identifying the individuals that make up the population.

 Note that this element can only be used for summary and subject-list reports where the basis is of the same type as the populations (e.g. a Patient-based measure, rather than an Encounter-based measure). In addition, the referenced Group resource SHALL be an actual (as opposed to a definitional) group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjects")]
    pub subjects: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjects")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subjects_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupPopulation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupPopulationBuilder {
        MeasureReportGroupPopulationBuilder::default()
    }
}
/// Choice of types for the measureScore[x] field in MeasureReportGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupMeasureScore {
    /// Variant accepting the Quantity type.
    #[serde(rename = "measureScoreQuantity")]
    Quantity(Quantity),
    /// Variant accepting the DateTime type.
    #[serde(rename = "measureScoreDateTime")]
    DateTime(DateTime),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "measureScoreCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Period type.
    #[serde(rename = "measureScorePeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "measureScoreRange")]
    Range(Range),
    /// Variant accepting the Duration type.
    #[serde(rename = "measureScoreDuration")]
    Duration(Duration),
}
/// Extension value for MeasureReportGroupMeasureScore.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupMeasureScoreExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_measureScoreQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_measureScoreDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_measureScoreCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_measureScorePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_measureScoreRange")]
    Range(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_measureScoreDuration")]
    Duration(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 stratifier from Measure**

 The stratifier from the Measure that corresponds to this stratifier in the MeasureReport resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureStratifierExample](http://hl7.org/fhir/ValueSet/measure-stratifier-example); What stratifier of the group**

 The meaning 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 = "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>,
    /** **Stratum results, one for each unique value, or set of values, in the stratifier, or stratifier components**

 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 CodeableConcept. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<MeasureReportGroupStratifierStratumValue>,
    /// 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<MeasureReportGroupStratifierStratumValueExtension>,
    /** **Stratifier component values**

 A stratifier component value.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<MeasureReportGroupStratifierStratumComponent>>,
    /// 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>>,
    /** **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(flatten)]
    pub measure_score: Option<MeasureReportGroupStratifierStratumMeasureScore>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_score_ext: Option<
        MeasureReportGroupStratifierStratumMeasureScoreExtension,
    >,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifierStratum {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierStratumBuilder {
        MeasureReportGroupStratifierStratumBuilder::default()
    }
}
/// Choice of types for the value[x] field in MeasureReportGroupStratifierStratum
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumValue {
    /// 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),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for MeasureReportGroupStratifierStratumValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumValueExtension {
    /// 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),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the component 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 = "MeasureReportGroupStratifierStratumComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroupStratifierStratumComponent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 stratifier component from Measure**

 The stratifier component from the Measure that corresponds to this stratifier component in the MeasureReport resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasureStratifierExample](http://hl7.org/fhir/ValueSet/measure-stratifier-example); What stratifier component of the group**

 The code for the stratum component value.

 */
    #[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 stratum component value, e.g. male**

 The stratum component value.

 */
    #[serde(flatten)]
    pub value: MeasureReportGroupStratifierStratumComponentValue,
    /// 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<MeasureReportGroupStratifierStratumComponentValueExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifierStratumComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierStratumComponentBuilder {
        MeasureReportGroupStratifierStratumComponentBuilder::default()
    }
}
/// Choice of types for the value[x] field in MeasureReportGroupStratifierStratumComponent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumComponentValue {
    /// 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),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for MeasureReportGroupStratifierStratumComponentValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumComponentValueExtension {
    /// 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),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 population from Measure**

 The population from the Measure that corresponds to this population in the MeasureReport resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **[MeasurePopulation](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 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 subject-list reports, the subject results in this population**

 This element refers to a List of individual level MeasureReport resources, one for each subject 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 = "subjectResults")]
    pub subject_results: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjectResults")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_results_ext: Option<FieldExtension>,
    /** **For subject-list reports, a subject result in this population**

 A reference to an individual level MeasureReport resource for a member of the population.

 This element SHALL NOT be used in with subjectResults, either systems provide results as a List of MeasureReport, or as references to individual MeasureReports. Note that using this element introduces a constraint on the size of the subject-list MeasureReport; implementations would be free to return a TOO-COSTLY response if a request is made for a subject-list report with too many subjects. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectReport")]
    pub subject_report: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subjectReport")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subject_report_ext: Vec<Option<FieldExtension>>,
    /** **What individual(s) in the population**

 Optional Group identifying the individuals that make up the population.

 Note that this element can only be used for summary and subject-list reports where the basis is of the same type as the populations (e.g. a Patient-based measure, rather than an Encounter-based measure). In addition, the referenced Group SHALL be an actual (as opposed to a definitional) group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjects")]
    pub subjects: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjects")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subjects_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifierStratumPopulation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierStratumPopulationBuilder {
        MeasureReportGroupStratifierStratumPopulationBuilder::default()
    }
}
/// Choice of types for the measureScore[x] field in MeasureReportGroupStratifierStratum
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumMeasureScore {
    /// Variant accepting the Quantity type.
    #[serde(rename = "measureScoreQuantity")]
    Quantity(Quantity),
    /// Variant accepting the DateTime type.
    #[serde(rename = "measureScoreDateTime")]
    DateTime(DateTime),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "measureScoreCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Period type.
    #[serde(rename = "measureScorePeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "measureScoreRange")]
    Range(Range),
    /// Variant accepting the Duration type.
    #[serde(rename = "measureScoreDuration")]
    Duration(Duration),
}
/// Extension value for MeasureReportGroupStratifierStratumMeasureScore.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MeasureReportGroupStratifierStratumMeasureScoreExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_measureScoreQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_measureScoreDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_measureScoreCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_measureScorePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_measureScoreRange")]
    Range(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_measureScoreDuration")]
    Duration(FieldExtension),
}
/** This resource is primarily used for the identification and definition of a medication, including ingredients, for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use.

 **[Medication](http://hl7.org/fhir/StructureDefinition/Medication) v5.0.0**

 Definition of a Medication

 This resource is primarily used for the identification and definition of a medication, including ingredients, for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Medication(pub Box<MedicationInner>);
/** This resource is primarily used for the identification and definition of a medication, including ingredients, for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use.

 **[Medication](http://hl7.org/fhir/StructureDefinition/Medication) v5.0.0**

 Definition of a Medication

 This resource is primarily used for the identification and definition of a medication, including ingredients, for the purposes of prescribing, dispensing, and administering a medication as well as for making statements about medication use.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this medication**

 Business identifier for this medication.

 The serial number could be included as an 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>>,
    /** **[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. Other codes can only be literal translations to alternative code systems, or codes at a lower level of granularity (e.g. a generic code for a vendor-specific primary one). */
    #[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 intended to identify if the medication in a local system is in active use within a drug database or inventory.  For example, a pharmacy system may create a new drug file record for a compounded product "ABC Hospital Special Cream" with an active status.  At some point in the future, it may be determined that the drug record was created with an error and the status is changed to "entered in error".   This status is not intended to specify if a medication is part of a particular formulary.  It is possible that the drug record may be referenced by multiple formularies or catalogues and each of those entries would have a separate status. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::MedicationStatusCodes>,
    /// 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>,
    /** **Organization that has authorization to market medication**

 The company or other legal entity that has authorization, from the appropriate drug regulatory authority,  to market a medicine in one or more jurisdictions.  Typically abbreviated MAH.Note:  The MAH may manufacture the product and may also contract the manufacturing of the product to one or more companies (organizations).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "marketingAuthorizationHolder")]
    pub marketing_authorization_holder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_marketingAuthorizationHolder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub marketing_authorization_holder_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 = "doseForm")]
    pub dose_form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseForm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_form_ext: Option<FieldExtension>,
    /** **When the specified product code does not infer a package size, this is the specific amount of drug in the product**

 When the specified product code does not infer a package size, this is the specific amount of drug in the product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalVolume")]
    pub total_volume: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalVolume")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_volume_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 = "batch")]
    pub batch: Option<MedicationBatch>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_batch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub batch_ext: Option<FieldExtension>,
    /** **Knowledge about this medication**

 A reference to a knowledge resource that provides more information about this medication.

 */
    #[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>,
}
#[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); The ingredient (substance or medication) that the ingredient.strength relates to**

 The ingredient (substance or medication) that the ingredient.strength relates to.  This is represented as a concept from a code system or described in another resource (Substance or Medication).

 */
    #[serde(rename = "item")]
    pub item: CodeableReference,
    /// 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>,
    /** **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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub strength: Option<MedicationIngredientStrength>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub strength_ext: Option<MedicationIngredientStrengthExtension>,
}
#[cfg(feature = "builders")]
impl MedicationIngredient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationIngredientBuilder {
        MedicationIngredientBuilder::default()
    }
}
/// Choice of types for the strength[x] field in MedicationIngredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationIngredientStrength {
    /// Variant accepting the Ratio type.
    #[serde(rename = "strengthRatio")]
    Ratio(Ratio),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "strengthCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "strengthQuantity")]
    Quantity(Quantity),
}
/// Extension value for MedicationIngredientStrength.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationIngredientStrengthExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_strengthRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_strengthCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_strengthQuantity")]
    Quantity(FieldExtension),
}
/// Sub-fields of the batch 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 = "MedicationBatchBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationBatch {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 MedicationBatch {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationBatchBuilder {
        MedicationBatchBuilder::default()
    }
}
/** 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. This event can also be used to record waste using a status of not-done and the appropriate statusReason.

 **[MedicationAdministration](http://hl7.org/fhir/StructureDefinition/MedicationAdministration) v5.0.0**

 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.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationAdministration(pub Box<MedicationAdministrationInner>);
/** 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. This event can also be used to record waste using a status of not-done and the appropriate statusReason.

 **[MedicationAdministration](http://hl7.org/fhir/StructureDefinition/MedicationAdministration) v5.0.0**

 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.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Identifiers associated with this Medication Administration 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. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource 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>>,
    /** **Plan this is fulfilled by this administration**

 A plan that is fulfilled in whole or in part by this MedicationAdministration.

 */
    #[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.

 MedicationDispense will be used to indicate waste. */
    #[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 | not-done | 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::MedicationAdministrationStatusCodes,
    /// 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>,
    /** **[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 = "statusReason")]
    pub status_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_reason_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationAdministrationLocation](http://hl7.org/fhir/ValueSet/medication-admin-location); Type of medication administration**

 The type of medication administration (for example, drug classification like ATC, where meds would be administered, legal category of the medication).

 */
    #[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>>,
    /** **[MedicationCode](http://hl7.org/fhir/ValueSet/medication-codes); 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(rename = "medication")]
    pub medication: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_medication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<FieldExtension>,
    /** **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 administered as part of**

 The visit, admission, or other contact between patient and health care provider during which the medication administration was performed.

 */
    #[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>,
    /** **Additional information to support administration**

 Additional information (for example, patient height and weight) that supports the administration of the medication.  This attribute can be used to provide documentation of specific characteristics of the patient present at the time of administration.  For example, if the dose says "give "x" if the heartrate exceeds "y"", then the heart rate can be included using this attribute.

 */
    #[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>>,
    /** **Specific date/time or interval of time during which the administration took place (or did not take place)**

 A specific date/time or interval of time during which the administration took place (or did not take place). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.

 */
    #[serde(flatten)]
    pub occurence: MedicationAdministrationOccurence,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurence_ext: Option<MedicationAdministrationOccurenceExtension>,
    /** **When the MedicationAdministration was first captured in the subject's record**

 The date the occurrence of the  MedicationAdministration was first captured in the record - potentially significantly after the occurrence of the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorded")]
    pub recorded: Option<DateTime>,
    /// 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>,
    /** **Full dose was not administered**

 An indication that the full dose was not administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isSubPotent")]
    pub is_sub_potent: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isSubPotent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_sub_potent_ext: Option<FieldExtension>,
    /** **[MedicationAdministrationSubPotentReason](http://hl7.org/fhir/ValueSet/administration-subpotent-reason); Reason full dose was not administered**

 The reason or reasons why the full dose was not administered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subPotentReason")]
    pub sub_potent_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subPotentReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_potent_reason_ext: Vec<Option<FieldExtension>>,
    /** **Who or what performed the medication administration and what type of performance they did**

 The performer of the medication treatment.  For devices this is the device that performed the administration of the medication.  An IV Pump would be an example of a device that is performing the administration. Both the IV Pump and the practitioner that set the rate or bolus on the pump can be listed as performers.

 */
    #[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>>,
    /** **[MedicationAdministrationReason](http://hl7.org/fhir/ValueSet/reason-medication-given-codes); Concept, condition or observation that supports why the medication was administered**

 A code, Condition or observation that supports why the medication 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<CodeableReference>>,
    /// 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>>,
    /** **Request administration performed against**

 The original request, instruction or authority to perform the administration.

 This is a reference to the MedicationRequest  where the intent is either order or instance-order.  It should not reference MedicationRequests where the intent is any other value. */
    #[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>,
    /** **Device used to administer**

 The device that is to be used for the administration of the medication (for example, PCA 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<CodeableReference>>,
    /// 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 might 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 occurence[x] field in MedicationAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationOccurence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurenceTiming")]
    Timing(Timing),
}
/// Extension value for MedicationAdministrationOccurence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationOccurenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurenceTiming")]
    Timing(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationAdministrationPerformerFunction](http://hl7.org/fhir/ValueSet/med-admin-perform-function); Type of performance**

 Distinguishes the type of involvement of the performer in the medication administration.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who or what performed the medication administration**

 Indicates who or what performed the medication administration.

 */
    #[serde(rename = "actor")]
    pub actor: CodeableReference,
    /// 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 [http://hl7.org/fhir/StructureDefinition/bodySite](http://hl7.org/fhir/extensions/StructureDefinition-bodySite.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),
}
/** 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.

 **[MedicationDispense](http://hl7.org/fhir/StructureDefinition/MedicationDispense) v5.0.0**

 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.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationDispense(pub Box<MedicationDispenseInner>);
/** 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.

 **[MedicationDispense](http://hl7.org/fhir/StructureDefinition/MedicationDispense) v5.0.0**

 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.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Identifiers associated with this Medication Dispense 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. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource 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>>,
    /** **Plan that is fulfilled by this dispense**

 A plan that is fulfilled in whole or in part by this MedicationDispense.

 */
    #[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>>,
    /** **Event that dispense is part of**

 The procedure or medication administration that triggered the dispense.

 While both a procedure and a medication administration may have triggered the dispense, but it is not expected that multiple procedures and/or multiple medication administrations would be triggers. */
    #[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/medicationdispense-status); preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown**

 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(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>,
    /** **[MedicationDispenseStatusReason](http://hl7.org/fhir/ValueSet/medicationdispense-status-reason); 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(rename = "notPerformedReason")]
    pub not_performed_reason: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notPerformedReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_performed_reason_ext: Option<FieldExtension>,
    /** **When the status changed**

 The date (and maybe time) when the status of the dispense record changed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusChanged")]
    pub status_changed: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusChanged")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_changed_ext: Option<FieldExtension>,
    /** **[MedicationDispenseAdminLocation](http://hl7.org/fhir/ValueSet/medicationdispense-admin-location); Type of medication dispense**

 Indicates the type of medication dispense (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).

 The category can be used to include where the medication is expected to be consumed or other types of dispenses.  Invariants can be used to bind to different value sets when profiling to bind. */
    #[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>>,
    /** **[MedicationCode](http://hl7.org/fhir/ValueSet/medication-codes); What medication was supplied**

 Identifies the medication supplied. 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(rename = "medication")]
    pub medication: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_medication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<FieldExtension>,
    /** **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(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 associated with event**

 The encounter 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 = "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>,
    /** **Information that supports the dispensing of the medication**

 Additional information that supports the medication being dispensed.  For example, there may be requirements that a specific lab test has been completed prior to dispensing or the patient's weight at the time of dispensing is documented.

 */
    #[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.

 */
    #[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>>,
    /** **Where the dispense occurred**

 The principal physical location where the dispense was performed.

 */
    #[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>,
    /** **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://terminology.hl7.org/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 the recording of the dispense started**

 The date (and maybe time) when the dispense activity started if whenPrepared or whenHandedOver is not populated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorded")]
    pub recorded: Option<DateTime>,
    /// 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>,
    /** **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/will be sent**

 Identification of the facility/location where the medication was/will be 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 or where the medication was delivered**

 Identifies the person who picked up the medication or the location of where the medication was delivered.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional or a location.

 */
    #[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>>,
    /** **Full representation of the dosage instructions**

 The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.

 The content of the renderedDosageInstructions must not be different than the dose represented in the dosageInstruction content. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "renderedDosageInstruction")]
    pub rendered_dosage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_renderedDosageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rendered_dosage_instruction_ext: 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>,
    /** **A list of relevant lifecycle events**

 A summary of the events of interest that have occurred, such as when the dispense was verified.

 This might 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
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationDispensePerformerFunction](http://hl7.org/fhir/ValueSet/medicationdispense-performer-function); Who performed the dispense and what they did**

 Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **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>,
}
#[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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://terminology.hl7.org/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://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason); Why was substitution made**

 Indicates the reason for the substitution (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 = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsibleParty")]
    pub responsible_party: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsibleParty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsible_party_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationDispenseSubstitution {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationDispenseSubstitutionBuilder {
        MedicationDispenseSubstitutionBuilder::default()
    }
}
/** Information about a medication that is used to support knowledge.

 **[MedicationKnowledge](http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) v5.0.0**

 Definition of Medication Knowledge

 Information about a medication that is used to support knowledge.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationKnowledge(pub Box<MedicationKnowledgeInner>);
/** Information about a medication that is used to support knowledge.

 **[MedicationKnowledge](http://hl7.org/fhir/StructureDefinition/MedicationKnowledge) v5.0.0**

 Definition of Medication Knowledge

 Information about a medication that is used to support knowledge.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationKnowledgeInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicationKnowledge::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicationKnowledge", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this medication**

 Business identifier for this medication.

 This is a business identifier, not a resource identifier (see discussion). */
    #[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>>,
    /** **[MedicationFormalRepresentation](http://hl7.org/fhir/ValueSet/medication-codes); Code that identifies this medication**

 A code that specifies 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. Other codes can only be literal translations to alternative code systems, or codes at a lower level of granularity (e.g. a generic code for a vendor-specific primary one). */
    #[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>,
    /** **[MedicationKnowledgeStatus](http://hl7.org/fhir/ValueSet/medicationknowledge-status); active | entered-in-error | inactive**

 A code to indicate if the medication referred to by this MedicationKnowledge is in active use within the drug database or inventory system. The status refers to the validity about the information of the medication and not to its medicinal properties.

 This status is intended to identify if the medication in a local system is in active use within a drug database or inventory.  For example, a pharmacy system may create a new drug file record for a compounded product "ABC Hospital Special Cream" with an active status.  At some point in the future, it may be determined that the drug record was created with an error and the status is changed to "entered in error".   This status is not intended to specify if a medication is part of a particular formulary.  It is possible that the drug record may be referenced by multiple formularies or catalogues and each of those entries would have a separate status. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::MedicationKnowledgeStatusCodes>,
    /// 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>,
    /** **Creator or owner of the knowledge or information about the medication**

 The creator or owner of the knowledge or information about the medication.

 */
    #[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>,
    /** **Codes that identify the different jurisdictions for which the information of this resource was created**

 Lists the jurisdictions that this medication knowledge was written for.

 The codes could have varying granularity from a country or group of countries down to a specific district. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedJurisdiction")]
    pub intended_jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_intendedJurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub intended_jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **A name associated with the medication being described**

 All of the names for a medication, for example, the name(s) given to a medication in different countries.  For example, acetaminophen and paracetamol or salbutamol and albuterol.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<String>>,
    /// 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>>,
    /** **Associated or related medication information**

 Associated or related medications. For example, if the medication is a branded product (e.g. Crestor), this is the Therapeutic Moeity (e.g. Rosuvastatin) or if this is a generic medication (e.g. Rosuvastatin), this would link to a branded product (e.g. Crestor.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedMedicationKnowledge")]
    pub related_medication_knowledge: Vec<
        Option<MedicationKnowledgeRelatedMedicationKnowledge>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedMedicationKnowledge")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_medication_knowledge_ext: Vec<Option<FieldExtension>>,
    /** **The set of medication resources that are associated with this medication**

 Links to associated medications that could be prescribed, dispensed or administered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "associatedMedication")]
    pub associated_medication: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_associatedMedication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub associated_medication_ext: Vec<Option<FieldExtension>>,
    /** **Category of the medication or product**

 Category of the medication or product (e.g. branded product, therapeutic moeity, generic product, innovator product, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productType")]
    pub product_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_productType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub product_type_ext: Vec<Option<FieldExtension>>,
    /** **Associated documentation about the medication**

 Associated documentation about the medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "monograph")]
    pub monograph: Vec<Option<MedicationKnowledgeMonograph>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_monograph")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub monograph_ext: Vec<Option<FieldExtension>>,
    /** **The instructions for preparing the medication**

 The instructions for preparing the medication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preparationInstruction")]
    pub preparation_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preparationInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preparation_instruction_ext: Option<FieldExtension>,
    /** **The pricing of the medication**

 The price of the medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cost")]
    pub cost: Vec<Option<MedicationKnowledgeCost>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_cost")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub cost_ext: Vec<Option<FieldExtension>>,
    /** **Program under which a medication is reviewed**

 The program under which the medication is reviewed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "monitoringProgram")]
    pub monitoring_program: Vec<Option<MedicationKnowledgeMonitoringProgram>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_monitoringProgram")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub monitoring_program_ext: Vec<Option<FieldExtension>>,
    /** **Guidelines or protocols for administration of the medication for an indication**

 Guidelines or protocols that are applicable for the administration of the medication based on indication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indicationGuideline")]
    pub indication_guideline: Vec<Option<MedicationKnowledgeIndicationGuideline>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_indicationGuideline")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub indication_guideline_ext: Vec<Option<FieldExtension>>,
    /** **Categorization of the medication within a formulary or classification system**

 Categorization of the medication within a formulary or classification system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "medicineClassification")]
    pub medicine_classification: Vec<Option<MedicationKnowledgeMedicineClassification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_medicineClassification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub medicine_classification_ext: Vec<Option<FieldExtension>>,
    /** **Details about packaged medications**

 Information that only applies to packages (not products).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packaging")]
    pub packaging: Vec<Option<MedicationKnowledgePackaging>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packaging")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub packaging_ext: Vec<Option<FieldExtension>>,
    /** **Potential clinical issue with or between medication(s)**

 Potential clinical issue with or between medication(s) (for example, drug-drug interaction, drug-disease contraindication, drug-allergy interaction, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalUseIssue")]
    pub clinical_use_issue: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_clinicalUseIssue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub clinical_use_issue_ext: Vec<Option<FieldExtension>>,
    /** **How the medication should be stored**

 Information on how the medication should be stored, for example, refrigeration temperatures and length of stability at a given temperature.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "storageGuideline")]
    pub storage_guideline: Vec<Option<MedicationKnowledgeStorageGuideline>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_storageGuideline")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub storage_guideline_ext: Vec<Option<FieldExtension>>,
    /** **Regulatory information about a medication**

 Regulatory information about a medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regulatory")]
    pub regulatory: Vec<Option<MedicationKnowledgeRegulatory>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_regulatory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub regulatory_ext: Vec<Option<FieldExtension>>,
    /** **Minimal definition information about the medication**

 Along with the link to a Medicinal Product Definition resource, this information provides common definitional elements that are needed to understand the specific medication that is being described.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definitional")]
    pub definitional: Option<MedicationKnowledgeDefinitional>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definitional")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definitional_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeBuilder {
    #[doc = concat!("Finalize building ", "MedicationKnowledge", ".")]
    pub fn build(self) -> Result<MedicationKnowledge, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationKnowledgeInner> for MedicationKnowledge {
    fn from(inner: MedicationKnowledgeInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicationKnowledge {
    type Target = MedicationKnowledgeInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicationKnowledge {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicationKnowledge {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationKnowledgeBuilder {
        MedicationKnowledgeBuilder::default()
    }
}
impl MedicationKnowledge {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicationKnowledge
    }
}
/// Sub-fields of the relatedMedicationKnowledge field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeRelatedMedicationKnowledgeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeRelatedMedicationKnowledge {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Category of medicationKnowledge**

 The category of the associated medication knowledge reference.

 */
    #[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>,
    /** **Associated documentation about the associated medication knowledge**

 Associated documentation about the associated medication knowledge.

 */
    #[serde(rename = "reference")]
    pub reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeRelatedMedicationKnowledge {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeRelatedMedicationKnowledgeBuilder {
        MedicationKnowledgeRelatedMedicationKnowledgeBuilder::default()
    }
}
/// Sub-fields of the monograph field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeMonographBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeMonograph {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 category of medication document**

 The category of documentation about the medication. (e.g. professional monograph, patient education monograph).

 */
    #[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>,
    /** **Associated documentation about the medication**

 Associated documentation about the medication.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeMonograph {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeMonographBuilder {
        MedicationKnowledgeMonographBuilder::default()
    }
}
/// Sub-fields of the cost field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeCostBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeCost {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 date range for which the cost is effective**

 The date range for which the cost information of the medication is effective.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectiveDate")]
    pub effective_date: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_effectiveDate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub effective_date_ext: Vec<Option<FieldExtension>>,
    /** **The category of the cost information**

 The category of the cost information.  For example, manufacturers' cost, patient cost, claim reimbursement cost, actual acquisition cost.

 */
    #[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>,
    /** **The source or owner for the price information**

 The source or owner that assigns the price to the medication.

 */
    #[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>,
    /** **The price or category of the cost of the medication**

 The price or representation of the cost (for example, Band A, Band B or $, $$) of the medication.

 */
    #[serde(flatten)]
    pub cost: MedicationKnowledgeCostCost,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cost_ext: Option<MedicationKnowledgeCostCostExtension>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeCost {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeCostBuilder {
        MedicationKnowledgeCostBuilder::default()
    }
}
/// Choice of types for the cost[x] field in MedicationKnowledgeCost
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeCostCost {
    /// Variant accepting the Money type.
    #[serde(rename = "costMoney")]
    Money(Money),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "costCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for MedicationKnowledgeCostCost.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeCostCostExtension {
    /// Variant accepting the Money extension.
    #[serde(rename = "_costMoney")]
    Money(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_costCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the monitoringProgram field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeMonitoringProgramBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeMonitoringProgram {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of program under which the medication is monitored**

 Type of program under which the medication is monitored.

 */
    #[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>,
    /** **Name of the reviewing program**

 Name of the reviewing program.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeMonitoringProgram {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeMonitoringProgramBuilder {
        MedicationKnowledgeMonitoringProgramBuilder::default()
    }
}
/// Sub-fields of the indicationGuideline field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeIndicationGuidelineBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeIndicationGuideline {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Indication for use that applies to the specific administration guideline**

 Indication or reason for use of the medication that applies to the specific administration guideline.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Guidelines for dosage of the medication**

 The guidelines for the dosage of the medication for the indication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosingGuideline")]
    pub dosing_guideline: Vec<
        Option<MedicationKnowledgeIndicationGuidelineDosingGuideline>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dosingGuideline")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dosing_guideline_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeIndicationGuideline {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeIndicationGuidelineBuilder {
        MedicationKnowledgeIndicationGuidelineBuilder::default()
    }
}
/// Sub-fields of the dosingGuideline field in MedicationKnowledgeIndicationGuideline
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeIndicationGuidelineDosingGuidelineBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeIndicationGuidelineDosingGuideline {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Intention of the treatment**

 The overall intention of the treatment, for example, prophylactic, supporative, curative, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "treatmentIntent")]
    pub treatment_intent: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_treatmentIntent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub treatment_intent_ext: Option<FieldExtension>,
    /** **Dosage for the medication for the specific guidelines**

 Dosage for the medication for the specific guidelines.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosage")]
    pub dosage: Vec<Option<MedicationKnowledgeIndicationGuidelineDosingGuidelineDosage>>,
    /// 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>>,
    /** **Type of treatment the guideline applies to**

 The type of the treatment that the guideline applies to, for example, long term therapy, first line treatment, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administrationTreatment")]
    pub administration_treatment: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_administrationTreatment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub administration_treatment_ext: Option<FieldExtension>,
    /** **Characteristics of the patient that are relevant to the administration guidelines**

 Characteristics of the patient that are relevant to the administration guidelines (for example, height, weight, gender, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientCharacteristic")]
    pub patient_characteristic: Vec<
        Option<
            MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristic,
        >,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_patientCharacteristic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub patient_characteristic_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeIndicationGuidelineDosingGuideline {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeIndicationGuidelineDosingGuidelineBuilder {
        MedicationKnowledgeIndicationGuidelineDosingGuidelineBuilder::default()
    }
}
/// Sub-fields of the dosage field in MedicationKnowledgeIndicationGuidelineDosingGuideline
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeIndicationGuidelineDosingGuidelineDosage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Category of dosage for a medication**

 The type or category of dosage for a given medication (for example, prophylaxis, maintenance, therapeutic, 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>,
    /** **Dosage for the medication for the specific guidelines**

 Dosage for the medication for the specific guidelines.

 */
    #[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 MedicationKnowledgeIndicationGuidelineDosingGuidelineDosage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageBuilder {
        MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageBuilder::default()
    }
}
/// Sub-fields of the patientCharacteristic field in MedicationKnowledgeIndicationGuidelineDosingGuideline
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Categorization of specific characteristic that is relevant to the administration guideline**

 The categorization of the specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).

 */
    #[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>,
    /** **The specific characteristic**

 The specific characteristic (e.g. height, weight, gender, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<
        MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicValue,
    >,
    /// 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<
        MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicValueExtension,
    >,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicBuilder {
        MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
}
/// Extension value for MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(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 medicineClassification field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeMedicineClassificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeMedicineClassification {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of category for the medication (for example, therapeutic classification, therapeutic sub-classification)**

 The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification).

 */
    #[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>,
    /** **The source of the classification**

 Either a textual source of the classification or a reference to an online source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<MedicationKnowledgeMedicineClassificationSource>,
    /// 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<MedicationKnowledgeMedicineClassificationSourceExtension>,
    /** **Specific category assigned to the medication**

 Specific category assigned to the medication (e.g. anti-infective, anti-hypertensive, antibiotic, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeMedicineClassification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeMedicineClassificationBuilder {
        MedicationKnowledgeMedicineClassificationBuilder::default()
    }
}
/// Choice of types for the source[x] field in MedicationKnowledgeMedicineClassification
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeMedicineClassificationSource {
    /// Variant accepting the String type.
    #[serde(rename = "sourceString")]
    String(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "sourceUri")]
    Uri(String),
}
/// Extension value for MedicationKnowledgeMedicineClassificationSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeMedicineClassificationSourceExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_sourceString")]
    String(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_sourceUri")]
    Uri(FieldExtension),
}
/// Sub-fields of the packaging field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgePackagingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgePackaging {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Cost of the packaged medication**

 The cost of the packaged medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cost")]
    pub cost: Vec<Option<MedicationKnowledgeCost>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_cost")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub cost_ext: Vec<Option<FieldExtension>>,
    /** **The packaged medication that is being priced**

 A reference to a PackagedProductDefinition that provides the details of the product that is in the packaging and is being priced.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packagedProduct")]
    pub packaged_product: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packagedProduct")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub packaged_product_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgePackaging {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgePackagingBuilder {
        MedicationKnowledgePackagingBuilder::default()
    }
}
/// Sub-fields of the storageGuideline field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeStorageGuidelineBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeStorageGuideline {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 additional information**

 Reference to additional information about the storage guidelines.

 */
    #[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>,
    /** **Additional storage notes**

 Additional notes about the storage.

 */
    #[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>>,
    /** **Duration remains stable**

 Duration that the medication remains stable if the environmentalSetting is respected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stabilityDuration")]
    pub stability_duration: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stabilityDuration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stability_duration_ext: Option<FieldExtension>,
    /** **Setting or value of environment for adequate storage**

 Describes a setting/value on the environment for the adequate storage of the medication and other substances.  Environment settings may involve temperature, humidity, or exposure to light.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "environmentalSetting")]
    pub environmental_setting: Vec<
        Option<MedicationKnowledgeStorageGuidelineEnvironmentalSetting>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_environmentalSetting")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub environmental_setting_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeStorageGuideline {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeStorageGuidelineBuilder {
        MedicationKnowledgeStorageGuidelineBuilder::default()
    }
}
/// Sub-fields of the environmentalSetting field in MedicationKnowledgeStorageGuideline
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeStorageGuidelineEnvironmentalSettingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeStorageGuidelineEnvironmentalSetting {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Categorization of the setting**

 Identifies the category or type of setting (e.g., type of location, temperature, humidity).

 */
    #[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>,
    /** **Value of the setting**

 Value associated to the setting. E.g., 40° – 50°F for temperature.

 */
    #[serde(flatten)]
    pub value: MedicationKnowledgeStorageGuidelineEnvironmentalSettingValue,
    /// 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<
        MedicationKnowledgeStorageGuidelineEnvironmentalSettingValueExtension,
    >,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeStorageGuidelineEnvironmentalSetting {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeStorageGuidelineEnvironmentalSettingBuilder {
        MedicationKnowledgeStorageGuidelineEnvironmentalSettingBuilder::default()
    }
}
/// Choice of types for the value[x] field in MedicationKnowledgeStorageGuidelineEnvironmentalSetting
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeStorageGuidelineEnvironmentalSettingValue {
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for MedicationKnowledgeStorageGuidelineEnvironmentalSettingValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeStorageGuidelineEnvironmentalSettingValueExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the regulatory field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeRegulatoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeRegulatory {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Specifies the authority of the regulation**

 The authority that is specifying the regulations.

 */
    #[serde(rename = "regulatoryAuthority")]
    pub regulatory_authority: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_regulatoryAuthority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub regulatory_authority_ext: Option<FieldExtension>,
    /** **Specifies if changes are allowed when dispensing a medication from a regulatory perspective**

 Specifies if changes are allowed when dispensing a medication from a regulatory perspective.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "substitution")]
    pub substitution: Vec<Option<MedicationKnowledgeRegulatorySubstitution>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_substitution")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub substitution_ext: Vec<Option<FieldExtension>>,
    /** **Specifies the schedule of a medication in jurisdiction**

 Specifies the schedule of a medication in jurisdiction.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **The maximum number of units of the medication that can be dispensed in a period**

 The maximum number of units of the medication that can be dispensed in a period.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxDispense")]
    pub max_dispense: Option<MedicationKnowledgeRegulatoryMaxDispense>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxDispense")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_dispense_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeRegulatory {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeRegulatoryBuilder {
        MedicationKnowledgeRegulatoryBuilder::default()
    }
}
/// Sub-fields of the substitution field in MedicationKnowledgeRegulatory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeRegulatorySubstitutionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeRegulatorySubstitution {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Specifies the type of substitution allowed**

 Specifies the type of substitution allowed.

 */
    #[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>,
    /** **Specifies if regulation allows for changes in the medication when dispensing**

 Specifies if regulation allows for changes in the medication when dispensing.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeRegulatorySubstitution {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeRegulatorySubstitutionBuilder {
        MedicationKnowledgeRegulatorySubstitutionBuilder::default()
    }
}
/// Sub-fields of the maxDispense field in MedicationKnowledgeRegulatory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeRegulatoryMaxDispenseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeRegulatoryMaxDispense {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 maximum number of units of the medication that can be dispensed**

 The maximum number of units of the medication that can be dispensed.

 */
    #[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>,
    /** **The period that applies to the maximum number of units**

 The period that applies to the maximum number of units.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Duration>,
    /// 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 MedicationKnowledgeRegulatoryMaxDispense {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeRegulatoryMaxDispenseBuilder {
        MedicationKnowledgeRegulatoryMaxDispenseBuilder::default()
    }
}
/// Sub-fields of the definitional field in MedicationKnowledge
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeDefinitionalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeDefinitional {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Definitional resources that provide more information about this medication**

 Associated definitions for this medication.

 */
    #[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>>,
    /** **[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 = "doseForm")]
    pub dose_form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseForm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_form_ext: Option<FieldExtension>,
    /** **[MedicationRoute](http://hl7.org/fhir/ValueSet/route-codes); The intended or approved route of administration**

 The intended or approved route of administration.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedRoute")]
    pub intended_route: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_intendedRoute")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub intended_route_ext: Vec<Option<FieldExtension>>,
    /** **Active or inactive ingredient**

 Identifies a particular constituent of interest in the product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<MedicationKnowledgeDefinitionalIngredient>>,
    /// 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>>,
    /** **Specifies descriptive properties of the medicine**

 Specifies descriptive properties of the medicine, such as color, shape, imprints, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "drugCharacteristic")]
    pub drug_characteristic: Vec<
        Option<MedicationKnowledgeDefinitionalDrugCharacteristic>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_drugCharacteristic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub drug_characteristic_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeDefinitional {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeDefinitionalBuilder {
        MedicationKnowledgeDefinitionalBuilder::default()
    }
}
/// Sub-fields of the ingredient field in MedicationKnowledgeDefinitional
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeDefinitionalIngredientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeDefinitionalIngredient {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Substances contained in the medication**

 A reference to the resource that provides information about the ingredient.

 */
    #[serde(rename = "item")]
    pub item: CodeableReference,
    /// 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>,
    /** **[MedicationIngredientIsActive](http://terminology.hl7.org/ValueSet/v3-RoleClassIngredientEntity); A code that defines the type of ingredient, active, base, etc**

 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 = "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>,
    /** **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 but can also be expressed a quantity when the denominator is assumed to be 1 tablet.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub strength: Option<MedicationKnowledgeDefinitionalIngredientStrength>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub strength_ext: Option<MedicationKnowledgeDefinitionalIngredientStrengthExtension>,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeDefinitionalIngredient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeDefinitionalIngredientBuilder {
        MedicationKnowledgeDefinitionalIngredientBuilder::default()
    }
}
/// Choice of types for the strength[x] field in MedicationKnowledgeDefinitionalIngredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeDefinitionalIngredientStrength {
    /// Variant accepting the Ratio type.
    #[serde(rename = "strengthRatio")]
    Ratio(Ratio),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "strengthCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "strengthQuantity")]
    Quantity(Quantity),
}
/// Extension value for MedicationKnowledgeDefinitionalIngredientStrength.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeDefinitionalIngredientStrengthExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_strengthRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_strengthCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_strengthQuantity")]
    Quantity(FieldExtension),
}
/// Sub-fields of the drugCharacteristic field in MedicationKnowledgeDefinitional
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationKnowledgeDefinitionalDrugCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationKnowledgeDefinitionalDrugCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationCharacteristic](http://hl7.org/fhir/ValueSet/medicationknowledge-characteristic); Code specifying the type of characteristic of medication**

 A code specifying which characteristic of the medicine is being described (for example, colour, shape, imprint).

 */
    #[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>,
    /** **Description of the characteristic**

 Description of the characteristic.

 The description should be provided as a CodeableConcept, SimpleQuantity or an image.  The description can be a string only when these others are not available. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<MedicationKnowledgeDefinitionalDrugCharacteristicValue>,
    /// 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<
        MedicationKnowledgeDefinitionalDrugCharacteristicValueExtension,
    >,
}
#[cfg(feature = "builders")]
impl MedicationKnowledgeDefinitionalDrugCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationKnowledgeDefinitionalDrugCharacteristicBuilder {
        MedicationKnowledgeDefinitionalDrugCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in MedicationKnowledgeDefinitionalDrugCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeDefinitionalDrugCharacteristicValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for MedicationKnowledgeDefinitionalDrugCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationKnowledgeDefinitionalDrugCharacteristicValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/** 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.

 **[MedicationRequest](http://hl7.org/fhir/StructureDefinition/MedicationRequest) v5.0.0**

 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>);
/** 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.

 **[MedicationRequest](http://hl7.org/fhir/StructureDefinition/MedicationRequest) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 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. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource 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>>,
    /** **A plan or request that is fulfilled in whole or in part by this medication request**

 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>>,
    /** **Reference to an order/prescription that is being replaced by this MedicationRequest**

 Reference to an order/prescription that is being replaced by this MedicationRequest.

 */
    #[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>,
    /** **Composite request this is part of**

 A shared identifier common to multiple independent Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 */
    #[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/medicationrequest-status); active | on-hold | ended | stopped | completed | cancelled | entered-in-error | 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.

Clinical decision support systems should take the status into account when determining which medications to include in their algorithms. */
    #[serde(rename = "status")]
    pub status: codes::MedicationRequestStatusCodes,
    /// 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>,
    /** **[MedicationRequestStatusReason](http://hl7.org/fhir/ValueSet/medicationrequest-status-reason); Reason for current status**

 Captures the reason for the current state of the MedicationRequest.

 This is generally only used for "exception" statuses such as "suspended" or "cancelled". The reason why the MedicationRequest was created at all is captured in reasonCode, not here. */
    #[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>,
    /** **When the status was changed**

 The date (and perhaps time) when the status was changed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusChanged")]
    pub status_changed: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusChanged")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_changed_ext: Option<FieldExtension>,
    /** **[MedicationRequestIntent](http://hl7.org/fhir/ValueSet/medicationrequest-intent); proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option**

 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::MedicationRequestIntentCodes,
    /// 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>,
    /** **[MedicationRequestAdministrationLocation](http://hl7.org/fhir/ValueSet/medicationrequest-admin-location); Grouping or category of medication request**

 An arbitrary categorization or grouping of the medication request.  It could be used for indicating where meds are intended to be administered, eg. in an inpatient setting or in a patient's home, or a legal category of the medication.

 The category can be used to include where the medication is expected to be consumed or other types of requests.  The examplar value set represents where the meds are intended to be administered and is just one example of request categorization. */
    #[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>>,
    /** **[MedicationRequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 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::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 patient is to stop taking or not to start taking the medication**

 If true, indicates that the provider is asking for the patient to either stop taking or to not start taking the specified medication. For example, the patient is taking an existing medication and the provider is changing their medication. They want to create two seperate requests: one to stop using the current medication and another to start the new medication.

 If do not perform is not specified, the request is a positive request e.g. "do perform". */
    #[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>,
    /** **[MedicationCode](http://hl7.org/fhir/ValueSet/medication-codes); 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(rename = "medication")]
    pub medication: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_medication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<FieldExtension>,
    /** **Individual or group for whom the medication has been requested**

 The individual or group for whom the medication has been requested.

 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>,
    /** **The person or organization who provided the information about this request, if the source is someone other than the requestor**

 The person or organization who provided the information about this request, if the source is someone other than the requestor.  This is often used when the MedicationRequest is reported by another person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSource")]
    pub information_source: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationSource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_source_ext: Vec<Option<FieldExtension>>,
    /** **Encounter created as part of encounter/admission/stay**

 The Encounter during which this [x] was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter."    If there is a need to link to episodes of care they will be handled with an extension. */
    #[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>,
    /** **Information to support fulfilling of the medication**

 Information to support fulfilling (i.e. dispensing or administering) of the medication, for example, patient height and weight, a MedicationStatement for the patient).

 This attribute can be used to reference a MedicationStatement about the patients' medication use. */
    #[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<Reference>,
    /// 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>,
    /** **Reported rather than primary record**

 Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.

 If not populated, then assume that this is the original record and not reported */
    #[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>,
    /** **[MedicationRequestPerformerType](http://hl7.org/fhir/ValueSet/medication-intended-performer-role); Desired kind of performer of the medication administration**

 Indicates the type of performer of the administration of the medication.

 If specified without indicating a performer, this indicates that the performer must be of the specified type. If specified with a performer then it indicates the requirements of the performer if the designated performer is not available. */
    #[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>,
    /** **Intended performer of administration**

 The specified desired performer of the medication treatment (e.g. the performer of the medication administration).  For devices, this is the device that is intended to perform the administration of the medication.  An IV Pump would be an example of a device that is performing the administration.  Both the IV Pump and the practitioner that set the rate or bolus on the pump can be listed as performers.

 */
    #[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>>,
    /** **Intended type of device for the administration**

 The intended type of device that is to be used for the administration of the medication (for example, PCA 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<CodeableReference>>,
    /// 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>>,
    /** **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 ordering or not ordering the medication**

 The reason or the indication for ordering or not 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 = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[MedicationRequestCourseOfTherapy](http://hl7.org/fhir/ValueSet/medicationrequest-course-of-therapy); Overall pattern of medication administration**

 The description of the overall pattern of the administration of the medication to the patient.

 This attribute should not be confused with the protocol of the medication. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "courseOfTherapyType")]
    pub course_of_therapy_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_courseOfTherapyType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub course_of_therapy_type_ext: Option<FieldExtension>,
    /** **Associated insurance coverage**

 Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<Reference>>,
    /// 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>>,
    /** **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>>,
    /** **Full representation of the dosage instructions**

 The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "renderedDosageInstruction")]
    pub rendered_dosage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_renderedDosageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rendered_dosage_instruction_ext: Option<FieldExtension>,
    /** **Period over which the medication is to be taken**

 The period over which the medication is to be taken.  Where there are multiple dosageInstruction lines (for example, tapering doses), this is the earliest date and the latest end date of the dosageInstructions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectiveDosePeriod")]
    pub effective_dose_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectiveDosePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_dose_period_ext: Option<FieldExtension>,
    /** **Specific instructions for how the medication should be taken**

 Specific instructions for 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. In general, each prescribed drug will be a separate Medication Request.

When drug orders are grouped together at the time of order entry,  but each of the drugs can be manipulated independently e.g. changing the status of one order to "completed" or "cancelled", changing another order status to "on-hold", the method to "group" all of the medication requests together is to use  MedicationRequest.groupIdentifier element.  All of the orders grouped together in this manner will have the same groupIdentifier, and separately, each order in the group may have a unique identifier.

There are cases that require grouping of Medication orders together when it is necessary to specify optionality e.g. order two drugs at one time, but stating either of these drugs may be used to treat the patient.  The use of a RequestOrchestration should be used as a parent for the Medication orders that require this type of grouping. An example when it may be necessary to group medication orders together is when you specify timing relationships e.g. order drug "xyz" with dose 123, then taper the same drug to a different dose after some interval of time
precedence:
e.g. give drug "abc" followed by drug "def"
e.g. give drug 30 minutes before some procedure was performed
more generically this supports - hierarchical groups of actions, where each specific action references the action to be performed (in terms of a Request resource), and each group describes additional behavior, relationships, and applicable conditions between the actions in the overall group.
Note that one should NOT use the List or Composition resource to accomplish the above requirements.  You may use List or Composition for other business requirements, but not to address the specific requirements of grouping medication orders. */
    #[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>,
    /** **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 might 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
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **First fill details**

 Indicates the quantity or duration for the first dispense of the medication.

 If populating this element, either the quantity or the duration must be included. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "initialFill")]
    pub initial_fill: Option<MedicationRequestDispenseRequestInitialFill>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_initialFill")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub initial_fill_ext: Option<FieldExtension>,
    /** **Minimum period of time between dispenses**

 The minimum period of time that must occur between dispenses of the medication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dispenseInterval")]
    pub dispense_interval: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dispenseInterval")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dispense_interval_ext: Option<FieldExtension>,
    /** **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.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.

 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<u32>,
    /// 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 performer of dispense**

 Indicates the intended performing Organization that will dispense the medication as specified by the prescriber.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dispenser")]
    pub dispenser: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dispenser")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dispenser_ext: Option<FieldExtension>,
    /** **Additional information for the dispenser**

 Provides additional information to the dispenser, for example, counselling to be provided to the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dispenserInstruction")]
    pub dispenser_instruction: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dispenserInstruction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dispenser_instruction_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationRequestDoseAdministrationAid](http://hl7.org/fhir/ValueSet/medication-dose-aid); Type of adherence packaging to use for the dispense**

 Provides information about the type of adherence packaging to be supplied for the medication dispense.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseAdministrationAid")]
    pub dose_administration_aid: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseAdministrationAid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_administration_aid_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 initialFill field in MedicationRequestDispenseRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationRequestDispenseRequestInitialFillBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationRequestDispenseRequestInitialFill {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **First fill quantity**

 The amount or quantity to provide as part of the first dispense.

 */
    #[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>,
    /** **First fill duration**

 The length of time that the first dispense is expected to last.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "duration")]
    pub duration: Option<Duration>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl MedicationRequestDispenseRequestInitialFill {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationRequestDispenseRequestInitialFillBuilder {
        MedicationRequestDispenseRequestInitialFillBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 modifier because whether substitution is allow or not, it cannot be ignored. */
    #[serde(flatten)]
    pub allowed: MedicationRequestSubstitutionAllowed,
    /// 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<MedicationRequestSubstitutionAllowedExtension>,
    /** **[MedicationIntendedSubstitutionReason](http://terminology.hl7.org/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()
    }
}
/// Choice of types for the allowed[x] field in MedicationRequestSubstitution
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationRequestSubstitutionAllowed {
    /// Variant accepting the Boolean type.
    #[serde(rename = "allowedBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "allowedCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for MedicationRequestSubstitutionAllowed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationRequestSubstitutionAllowedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_allowedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_allowedCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** 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 medicationstatement and a medicationadministration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medicationstatement 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.

 **[MedicationStatement](http://hl7.org/fhir/StructureDefinition/MedicationStatement) v5.0.0**

 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 medicationstatement and a medicationadministration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medicationstatement 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.

The MedicationStatement resource was previously called MedicationStatement.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationStatement(pub Box<MedicationStatementInner>);
/** 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 medicationstatement and a medicationadministration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medicationstatement 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.

 **[MedicationStatement](http://hl7.org/fhir/StructureDefinition/MedicationStatement) v5.0.0**

 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 medicationstatement and a medicationadministration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medicationstatement 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.

The MedicationStatement resource was previously called MedicationStatement.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Identifiers associated with this Medication Statement 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. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource 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>>,
    /** **Part of referenced event**

 A larger event of which this particular MedicationStatement 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>>,
    /** **[MedicationStatementStatus](http://hl7.org/fhir/ValueSet/medication-statement-status); recorded | entered-in-error | draft**

 A code representing the status of recording the medication statement.

 This status concerns just the recording of the medication statement.  MedicationStatement.adherence should be used for indicating a patient's adherence to the information in this resource.  Note, the statuses are different than in previous releases for MedicationStatement or MedicationStatement.

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::MedicationStatementStatusCodes,
    /// 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>,
    /** **[MedicationStatementAdministrationLocation](http://hl7.org/fhir/ValueSet/medicationrequest-admin-location); Type of medication statement**

 Type of medication statement (for example, drug classification like ATC, where meds would be administered, legal category of the medication.).

 */
    #[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>>,
    /** **[MedicationCode](http://hl7.org/fhir/ValueSet/medication-codes); 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(rename = "medication")]
    pub medication: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_medication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_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>,
    /** **Encounter associated with MedicationStatement**

 The encounter 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 = "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>,
    /** **The date/time or interval when the medication is/was/will be taken**

 The interval of time during which it is being asserted that the patient is/was/will be taking the medication (or was not taking, when the MedicationStatement.adherence element is Not Taking).

 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 and is expected to continue indefinitely at the time the usage is recorded, the "end" date will be omitted.  If the end date is known, then it is included as the "end date".  The date/time attribute supports a variety of dates - year, year/month and exact date.  If something more than this is required, this should be conveyed as text. */
    #[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 usage 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSource")]
    pub information_source: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationSource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_source_ext: Vec<Option<FieldExtension>>,
    /** **Link to information used to derive the MedicationStatement**

 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>>,
    /** **[MedicationReason](http://hl7.org/fhir/ValueSet/condition-code); Reason for why the medication is being/was taken**

 A concept, Condition or observation that supports 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 = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Further information about the usage**

 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>>,
    /** **Link to information relevant to the usage of a medication**

 Link to information that is relevant to a medication statement, for example, illicit drug use, gestational age, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedClinicalInformation")]
    pub related_clinical_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedClinicalInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_clinical_information_ext: Vec<Option<FieldExtension>>,
    /** **Full representation of the dosage instructions**

 The full representation of the dose of the medication included in all dosage instructions.  To be used when multiple dosage instructions are included to represent complex dosing such as increasing or tapering doses.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "renderedDosageInstruction")]
    pub rendered_dosage_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_renderedDosageInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rendered_dosage_instruction_ext: 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>>,
    /** **Indicates whether the medication is or is not being consumed or administered**

 Indicates whether the medication is or is not being consumed or administered.

 This element can be used to indicate whether a patient is following a course of treatment as instructed/prescribed or whether they are taking medications of their own volition.  It can also be used to indicate that a patient is not taking a medication, either because they were told not to or because they decided on their own. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adherence")]
    pub adherence: Option<MedicationStatementAdherence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adherence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adherence_ext: 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 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),
    /// Variant accepting the Timing type.
    #[serde(rename = "effectiveTiming")]
    Timing(Timing),
}
/// 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),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_effectiveTiming")]
    Timing(FieldExtension),
}
/// Sub-fields of the adherence field in MedicationStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationStatementAdherenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationStatementAdherence {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationStatementAdherence](http://hl7.org/fhir/ValueSet/medication-statement-adherence); Type of adherence**

 Type of the adherence for the medication.

 */
    #[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>,
    /** **[MedicationStatementStatusReason](http://hl7.org/fhir/ValueSet/reason-medication-status-codes); Details of the reason for the current use of the medication**

 Captures the reason for the current use or adherence of a medication.

 This is generally only used for "exception" statuses such as "entered-in-error". The reason for performing the event at all is captured in reasonCode, not here. */
    #[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 MedicationStatementAdherence {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationStatementAdherenceBuilder {
        MedicationStatementAdherenceBuilder::default()
    }
}
/** Detailed definition of a medicinal product, typically for uses other than direct patient care (e.g. regulatory use, drug catalogs, to support prescribing, adverse events management etc.).

 **[MedicinalProductDefinition](http://hl7.org/fhir/StructureDefinition/MedicinalProductDefinition) v5.0.0**

 Detailed definition of a medicinal product

 A medicinal product, being a substance or combination of substances that is intended to treat, prevent or diagnose a disease, or to restore, correct or modify physiological functions by exerting a pharmacological, immunological or metabolic action. This resource is intended to define and detail such products and their properties, for uses other than direct patient care (e.g. regulatory use, or drug catalogs).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicinalProductDefinition(pub Box<MedicinalProductDefinitionInner>);
/** Detailed definition of a medicinal product, typically for uses other than direct patient care (e.g. regulatory use, drug catalogs, to support prescribing, adverse events management etc.).

 **[MedicinalProductDefinition](http://hl7.org/fhir/StructureDefinition/MedicinalProductDefinition) v5.0.0**

 Detailed definition of a medicinal product

 A medicinal product, being a substance or combination of substances that is intended to treat, prevent or diagnose a disease, or to restore, correct or modify physiological functions by exerting a pharmacological, immunological or metabolic action. This resource is intended to define and detail such products and their properties, for uses other than direct patient care (e.g. regulatory use, or drug catalogs).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicinalProductDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicinalProductDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicinalProductDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this product. Could be an MPID**

 Business identifier for this product. Could be an MPID. When in development or being regulated, products are typically referenced by official identifiers, assigned by a manufacturer or regulator, and unique to a product (which, when compared to a product instance being prescribed, is actually a product type). See also MedicinalProductDefinition.code.

 */
    #[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>>,
    /** **[MedicinalProductType](http://hl7.org/fhir/ValueSet/medicinal-product-type); Regulatory type, e.g. Investigational or Authorized**

 Regulatory type, e.g. Investigational or Authorized.

 */
    #[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>,
    /** **[MedicinalProductType](http://hl7.org/fhir/ValueSet/medicinal-product-domain); If this medicine applies to human or veterinary uses**

 If this medicine applies to human or veterinary uses.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "domain")]
    pub domain: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_domain")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub domain_ext: Option<FieldExtension>,
    /** **A business identifier relating to a specific version of the product**

 A business identifier relating to a specific version of the product, this is commonly used to support revisions to an existing product.

 */
    #[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); The status within the lifecycle of this product record**

 The status within the lifecycle of this product record. A high-level status, this is not intended to duplicate details carried elsewhere such as legal status, or authorization status.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 date at which the given status became applicable**

 The date at which the given status became applicable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<DateTime>,
    /// 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>,
    /** **General description of this product**

 General description of this product.

 */
    #[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>,
    /** **[CombinedDoseForm](http://hl7.org/fhir/ValueSet/combined-dose-form); The dose form for a single part product, or combined form of a multiple part product**

 The dose form for a single part product, or combined form of a multiple part product. This is one concept that describes all the components. It does not represent the form with components physically mixed, if that might be necessary, for which see (AdministrableProductDefinition.administrableDoseForm).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "combinedPharmaceuticalDoseForm")]
    pub combined_pharmaceutical_dose_form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_combinedPharmaceuticalDoseForm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub combined_pharmaceutical_dose_form_ext: Option<FieldExtension>,
    /** **[SNOMEDCTRouteCodes](http://hl7.org/fhir/ValueSet/route-codes); The path by which the product is taken into or makes contact with the body**

 The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route. See also AdministrableProductDefinition resource. MedicinalProductDefinition.route is the same concept as AdministrableProductDefinition.routeOfAdministration.code, and they cannot be used together.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "route")]
    pub route: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_route")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub route_ext: Vec<Option<FieldExtension>>,
    /** **Description of indication(s) for this product, used when structured indications are not required**

 Description of indication(s) for this product, used when structured indications are not required. In cases where structured indications are required, they are captured using the ClinicalUseDefinition resource. An indication is a medical situation for which using the product is appropriate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_indication")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub indication_ext: Option<FieldExtension>,
    /** **[LegalStatusOfSupply](http://hl7.org/fhir/ValueSet/legal-status-of-supply); The legal status of supply of the medicinal product as classified by the regulator**

 The legal status of supply of the medicinal product as classified by the regulator.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "legalStatusOfSupply")]
    pub legal_status_of_supply: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_legalStatusOfSupply")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub legal_status_of_supply_ext: Option<FieldExtension>,
    /** **[AdditionalMonitoring](http://hl7.org/fhir/ValueSet/medicinal-product-additional-monitoring); Whether the Medicinal Product is subject to additional monitoring for regulatory reasons**

 Whether the Medicinal Product is subject to additional monitoring for regulatory reasons, such as heightened reporting requirements.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additionalMonitoringIndicator")]
    pub additional_monitoring_indicator: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_additionalMonitoringIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub additional_monitoring_indicator_ext: Option<FieldExtension>,
    /** **[SpecialMeasures](http://hl7.org/fhir/ValueSet/medicinal-product-special-measures); Whether the Medicinal Product is subject to special measures for regulatory reasons**

 Whether the Medicinal Product is subject to special measures for regulatory reasons, such as a requirement to conduct post-authorization studies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialMeasures")]
    pub special_measures: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialMeasures")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub special_measures_ext: Vec<Option<FieldExtension>>,
    /** **[PediatricUse](http://hl7.org/fhir/ValueSet/medicinal-product-pediatric-use); If authorised for use in children**

 If authorised for use in children, or infants, neonates etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pediatricUseIndicator")]
    pub pediatric_use_indicator: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_pediatricUseIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pediatric_use_indicator_ext: Option<FieldExtension>,
    /** **[ProductClassification](http://hl7.org/fhir/ValueSet/medicinal-product-classification); Allows the product to be classified by various systems**

 Allows the product to be classified by various systems, commonly WHO ATC.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
    /** **Marketing status of the medicinal product, in contrast to marketing authorization**

 Marketing status of the medicinal product, in contrast to marketing authorization. This refers to the product being actually 'on the market' as opposed to being allowed to be on the market (which is an authorization).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "marketingStatus")]
    pub marketing_status: Vec<Option<MarketingStatus>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_marketingStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub marketing_status_ext: Vec<Option<FieldExtension>>,
    /** **[MedicinalProductPackageType](http://hl7.org/fhir/ValueSet/medicinal-product-package-type); Package type for the product**

 Package type for the product. See also the PackagedProductDefinition resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packagedMedicinalProduct")]
    pub packaged_medicinal_product: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packagedMedicinalProduct")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub packaged_medicinal_product_ext: Vec<Option<FieldExtension>>,
    /** **Types of medicinal manufactured items and/or devices that this product consists of, such as tablets, capsule, or syringes**

 Types of medicinal manufactured items and/or devices that this product consists of, such as tablets, capsule, or syringes. Used as a direct link when the item's packaging is not being recorded (see also PackagedProductDefinition.package.containedItem.item).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comprisedOf")]
    pub comprised_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_comprisedOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub comprised_of_ext: Vec<Option<FieldExtension>>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); The ingredients of this medicinal product - when not detailed in other resources**

 The ingredients of this medicinal product - when not detailed in other resources. This is only needed if the ingredients are not specified by incoming references from the Ingredient resource, or indirectly via incoming AdministrableProductDefinition, PackagedProductDefinition or ManufacturedItemDefinition references. In cases where those levels of detail are not used, the ingredients may be specified directly here as codes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[SNOMEDCTSubstanceCodes](http://hl7.org/fhir/ValueSet/substance-codes); Any component of the drug product which is not the chemical entity defined as the drug substance, or an excipient in the drug product**

 Any component of the drug product which is not the chemical entity defined as the drug substance, or an excipient in the drug product. This includes process-related impurities and contaminants, product-related impurities including degradation products.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "impurity")]
    pub impurity: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_impurity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub impurity_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation about the medicinal product**

 Additional information or supporting documentation about the medicinal product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attachedDocument")]
    pub attached_document: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attachedDocument")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attached_document_ext: Vec<Option<FieldExtension>>,
    /** **A master file for the medicinal product (e.g. Pharmacovigilance System Master File)**

 A master file for the medicinal product (e.g. Pharmacovigilance System Master File). Drug master files (DMFs) are documents submitted to regulatory agencies to provide confidential detailed information about facilities, processes or articles used in the manufacturing, processing, packaging and storing of drug products.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "masterFile")]
    pub master_file: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_masterFile")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub master_file_ext: Vec<Option<FieldExtension>>,
    /** **A product specific contact, person (in a role), or an organization**

 A product specific contact, person (in a role), or an organization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<MedicinalProductDefinitionContact>>,
    /// 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>>,
    /** **Clinical trials or studies that this product is involved in**

 Clinical trials or studies that this product is involved in.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalTrial")]
    pub clinical_trial: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_clinicalTrial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub clinical_trial_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationFormalRepresentation](http://hl7.org/fhir/ValueSet/medication-codes); A code that this product is known by, within some formal terminology**

 A code that this product is known by, usually within some formal terminology, perhaps assigned by a third party (i.e. not the manufacturer or regulator). Products (types of medications) tend to be known by identifiers during development and within regulatory process. However when they are prescribed they tend to be identified by codes. The same product may be have multiple codes, applied to it by multiple organizations.

 */
    #[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>>,
    /** **The product's name, including full name and possibly coded parts**

 The product's name, including full name and possibly coded parts.

 */
    #[serde(rename = "name")]
    pub name: Vec<Option<MedicinalProductDefinitionName>>,
    /// 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>>,
    /** **Reference to another product, e.g. for linking authorised to investigational product**

 Reference to another product, e.g. for linking authorised to investigational product, or a virtual product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "crossReference")]
    pub cross_reference: Vec<Option<MedicinalProductDefinitionCrossReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_crossReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub cross_reference_ext: Vec<Option<FieldExtension>>,
    /** **A manufacturing or administrative process for the medicinal product**

 A manufacturing or administrative process or step associated with (or performed on) the medicinal product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Vec<Option<MedicinalProductDefinitionOperation>>,
    /// 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>>,
    /** **Key product features such as "sugar free", "modified release"**

 Allows the key product features to be recorded, such as "sugar free", "modified release", "parallel import".

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<MedicinalProductDefinitionCharacteristic>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionBuilder {
    #[doc = concat!("Finalize building ", "MedicinalProductDefinition", ".")]
    pub fn build(
        self,
    ) -> Result<MedicinalProductDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicinalProductDefinitionInner> for MedicinalProductDefinition {
    fn from(inner: MedicinalProductDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicinalProductDefinition {
    type Target = MedicinalProductDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicinalProductDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicinalProductDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionBuilder {
        MedicinalProductDefinitionBuilder::default()
    }
}
impl MedicinalProductDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicinalProductDefinition
    }
}
/// Sub-fields of the contact field in MedicinalProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionContactBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionContact {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProductContactType](http://hl7.org/fhir/ValueSet/medicinal-product-contact-type); Allows the contact to be classified, for example QPPV, Pharmacovigilance Enquiry Information**

 Allows the contact to be classified, for example QPPV, Pharmacovigilance Enquiry Information.

 */
    #[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>,
    /** **A product specific contact, person (in a role), or an organization**

 A product specific contact, person (in a role), or an organization.

 */
    #[serde(rename = "contact")]
    pub contact: Reference,
    /// 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>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionContact {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionContactBuilder {
        MedicinalProductDefinitionContactBuilder::default()
    }
}
/// Sub-fields of the name field in MedicinalProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionNameBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionName {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 full product name**

 The full product name.

 */
    #[serde(rename = "productName")]
    pub product_name: 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>,
    /** **[ProductNameType](http://hl7.org/fhir/ValueSet/medicinal-product-name-type); Type of product name, such as rINN, BAN, Proprietary, Non-Proprietary**

 Type of product name, such as rINN, BAN, Proprietary, Non-Proprietary.

 */
    #[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>,
    /** **Coding words or phrases of the name**

 Coding words or phrases of the name.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Vec<Option<MedicinalProductDefinitionNamePart>>,
    /// 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>>,
    /** **Country and jurisdiction where the name applies**

 Country and jurisdiction where the name applies, and associated language.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Vec<Option<MedicinalProductDefinitionNameUsage>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionName {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionNameBuilder {
        MedicinalProductDefinitionNameBuilder::default()
    }
}
/// Sub-fields of the part field in MedicinalProductDefinitionName
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionNamePartBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionNamePart {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 fragment of a product name**

 A fragment of a product name.

 */
    #[serde(rename = "part")]
    pub part: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_ext: Option<FieldExtension>,
    /** **[ProductNamePartType](http://hl7.org/fhir/ValueSet/medicinal-product-name-part-type); Identifying type for this part of the name (e.g. strength part)**

 Identifying type for this part of the name (e.g. strength part).

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionNamePart {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionNamePartBuilder {
        MedicinalProductDefinitionNamePartBuilder::default()
    }
}
/// Sub-fields of the usage field in MedicinalProductDefinitionName
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionNameUsageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionNameUsage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Country](http://hl7.org/fhir/ValueSet/country); Country code for where this name applies**

 Country code for where this name applies.

 */
    #[serde(rename = "country")]
    pub country: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_country")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub country_ext: Option<FieldExtension>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Jurisdiction code for where this name applies**

 Jurisdiction code for where this name applies. A jurisdiction may be a sub- or supra-national entity (e.g. a state or a geographic region).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Option<CodeableConcept>,
    /// 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>,
    /** **[Language](http://hl7.org/fhir/ValueSet/all-languages); Language code for this name**

 Language code for this name.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionNameUsage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionNameUsageBuilder {
        MedicinalProductDefinitionNameUsageBuilder::default()
    }
}
/// Sub-fields of the crossReference field in MedicinalProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionCrossReferenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionCrossReference {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 another product, e.g. for linking authorised to investigational product**

 Reference to another product, e.g. for linking authorised to investigational product.

 */
    #[serde(rename = "product")]
    pub product: CodeableReference,
    /// 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>,
    /** **[ProductCrossReferenceType](http://hl7.org/fhir/ValueSet/medicinal-product-cross-reference-type); The type of relationship, for instance branded to generic or virtual to actual product**

 The type of relationship, for instance branded to generic, virtual to actual product, product to development product (investigational), parallel import version.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionCrossReference {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionCrossReferenceBuilder {
        MedicinalProductDefinitionCrossReferenceBuilder::default()
    }
}
/// Sub-fields of the operation field in MedicinalProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionOperation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of manufacturing operation e.g. manufacturing itself, re-packaging**

 The type of manufacturing operation e.g. manufacturing itself, re-packaging. For the authorization of this, a RegulatedAuthorization would point to the same plan or activity referenced here.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableReference>,
    /// 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 range of applicability**

 Date range of applicability.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectiveDate")]
    pub effective_date: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectiveDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_date_ext: Option<FieldExtension>,
    /** **The organization responsible for the particular process, e.g. the manufacturer or importer**

 The organization or establishment responsible for (or associated with) the particular process or step, examples include the manufacturer, importer, agent.

 */
    #[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>>,
    /** **[ProductConfidentiality](http://hl7.org/fhir/ValueSet/medicinal-product-confidentiality); Specifies whether this process is considered proprietary or confidential**

 Specifies whether this particular business or manufacturing process is considered proprietary or confidential.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "confidentialityIndicator")]
    pub confidentiality_indicator: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_confidentialityIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub confidentiality_indicator_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionOperationBuilder {
        MedicinalProductDefinitionOperationBuilder::default()
    }
}
/// Sub-fields of the characteristic field in MedicinalProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicinalProductDefinitionCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicinalProductDefinitionCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProductCharacteristic](http://hl7.org/fhir/ValueSet/product-characteristic-codes); A code expressing the type of characteristic**

 A code expressing the type of characteristic.

 */
    #[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>,
    /** **A value for the characteristic**

 A value for the characteristic.text.

 Text, as markdown, is intended to be used only when the item cannot ever reasonably be coded. Otherwise, for cases where a code is not available, but is feasible, use CodeableConcept.text. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<MedicinalProductDefinitionCharacteristicValue>,
    /// 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<MedicinalProductDefinitionCharacteristicValueExtension>,
}
#[cfg(feature = "builders")]
impl MedicinalProductDefinitionCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicinalProductDefinitionCharacteristicBuilder {
        MedicinalProductDefinitionCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in MedicinalProductDefinitionCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicinalProductDefinitionCharacteristicValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for MedicinalProductDefinitionCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicinalProductDefinitionCharacteristicValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/** 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.

 **[MessageDefinition](http://hl7.org/fhir/StructureDefinition/MessageDefinition) v5.0.0**

 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>);
/** 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.

 **[MessageDefinition](http://hl7.org/fhir/StructureDefinition/MessageDefinition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 cannonical URL for a given MessageDefinition**

 The business identifier that is used to reference the MessageDefinition and *is* expected to be consistent from server to server.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 Identifier for a given MessageDefinition**

 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, and can then identify this message 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 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 reference to a particular business version of the message definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<MessageDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<MessageDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **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<String>>,
    /// 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>>,
    /** **[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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the message definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 message definition is presumed to be the predominant language in the place the message definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate message definition instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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<String>,
    /// 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.

 It should be possible to use MessageDefinition to describe a message to be used by certain steps in a particular protocol as part of a PlanDefinition or ActivityDefinition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Vec<Option<String>>,
    /// 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>>,
    /** **Event code  or link to the EventDefinition**

 Event code or link to the EventDefinition.

 */
    #[serde(flatten)]
    pub event: MessageDefinitionEvent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_ext: Option<MessageDefinitionEventExtension>,
    /** **[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>>,
    /** **[messageheader-response-request](http://hl7.org/fhir/ValueSet/messageheader-response-request); always | on-error | never | on-success**

 Declare at a message definition level whether a response is required or only upon error or success, or never.

 This enables the capability currently available through MSH-16 (Application Level acknowledgement) in HL7 Version 2 to declare at a message instance level whether a response is required or only upon error or success, or never. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responseRequired")]
    pub response_required: Option<codes::MessageheaderResponseRequest>,
    /// 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>>,
    /** **Canonical reference to a GraphDefinition**

 Graph is Canonical reference to a GraphDefinition. If a URL is provided, it is the canonical reference to a GraphDefinition that it controls what additional resources are to be added to the Bundle when building the message. The GraphDefinition can also specify profiles that apply to the various resources.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "graph")]
    pub graph: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_graph")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub graph_ext: 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in MessageDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for MessageDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the event[x] field in MessageDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageDefinitionEvent {
    /// Variant accepting the Coding type.
    #[serde(rename = "eventCoding")]
    Coding(Coding),
    /// Variant accepting the Uri type.
    #[serde(rename = "eventUri")]
    Uri(String),
}
/// Extension value for MessageDefinitionEvent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageDefinitionEventExtension {
    /// Variant accepting the Coding extension.
    #[serde(rename = "_eventCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_eventUri")]
    Uri(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
    /** **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<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>,
    /** **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(rename = "min")]
    pub min: 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
    /** **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()
    }
}
/** 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.

 **[MessageHeader](http://hl7.org/fhir/StructureDefinition/MessageHeader) v5.0.0**

 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>);
/** 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.

 **[MessageHeader](http://hl7.org/fhir/StructureDefinition/MessageHeader) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Event code or link to EventDefinition**

 Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification are defined by the implementation.  Alternatively a canonical uri to the EventDefinition.

 The time of the event will be found in the focus resource. The time of the message will be found in [Bundle.timestamp](bundle-definitions.html#Bundle.timestamp). */
    #[serde(flatten)]
    pub event: MessageHeaderEvent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_ext: Option<MessageHeaderEventExtension>,
    /** **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>>,
    /** **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. Proposing to remove and rely on Task to convey this information. */
    #[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>,
    /** **The source of the decision**

 The logical author of the message - the personor 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.Proposing to remove and rely on Task to convey this information.  */
    #[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.Proposing to remove and rely on Task to convey this information. */
    #[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. This is allowed to be a Parameters resource.

 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>>,
    /** **Link to the definition for this message**

 Permanent link to the MessageDefinition for this message.

 */
    #[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>,
}
#[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
    }
}
/// Choice of types for the event[x] field in MessageHeader
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderEvent {
    /// Variant accepting the Coding type.
    #[serde(rename = "eventCoding")]
    Coding(Coding),
    /// Variant accepting the Canonical type.
    #[serde(rename = "eventCanonical")]
    Canonical(String),
}
/// Extension value for MessageHeaderEvent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderEventExtension {
    /// Variant accepting the Coding extension.
    #[serde(rename = "_eventCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_eventCanonical")]
    Canonical(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Actual destination address or Endpoint resource**

 Indicates where the message should be routed.

 The url may be a non-resolvable URI for systems that do not use standard network-based addresses. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub endpoint: Option<MessageHeaderDestinationEndpoint>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub endpoint_ext: Option<MessageHeaderDestinationEndpointExtension>,
    /** **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>,
    /** **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>,
}
#[cfg(feature = "builders")]
impl MessageHeaderDestination {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageHeaderDestinationBuilder {
        MessageHeaderDestinationBuilder::default()
    }
}
/// Choice of types for the endpoint[x] field in MessageHeaderDestination
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderDestinationEndpoint {
    /// Variant accepting the Url type.
    #[serde(rename = "endpointUrl")]
    Url(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "endpointReference")]
    Reference(Reference),
}
/// Extension value for MessageHeaderDestinationEndpoint.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderDestinationEndpointExtension {
    /// Variant accepting the Url extension.
    #[serde(rename = "_endpointUrl")]
    Url(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_endpointReference")]
    Reference(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Actual source address or Endpoint resource**

 Identifies the routing target to send acknowledgements to.

 The url may be a non-resolvable URI for systems that do not use standard network-based addresses. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub endpoint: Option<MessageHeaderSourceEndpoint>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub endpoint_ext: Option<MessageHeaderSourceEndpointExtension>,
    /** **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>,
}
#[cfg(feature = "builders")]
impl MessageHeaderSource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageHeaderSourceBuilder {
        MessageHeaderSourceBuilder::default()
    }
}
/// Choice of types for the endpoint[x] field in MessageHeaderSource
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderSourceEndpoint {
    /// Variant accepting the Url type.
    #[serde(rename = "endpointUrl")]
    Url(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "endpointReference")]
    Reference(Reference),
}
/// Extension value for MessageHeaderSourceEndpoint.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageHeaderSourceEndpointExtension {
    /// Variant accepting the Url extension.
    #[serde(rename = "_endpointUrl")]
    Url(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_endpointReference")]
    Reference(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Bundle.identifier of original message**

 The Bundle.identifier of the message to which this message is a response.

 */
    #[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>,
    /** **[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()
    }
}
/** Representation of a molecular sequence.

 **[MolecularSequence](http://hl7.org/fhir/StructureDefinition/MolecularSequence) v5.0.0**

 Representation of a molecular sequence

 Representation of a molecular sequence.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MolecularSequence(pub Box<MolecularSequenceInner>);
/** Representation of a molecular sequence.

 **[MolecularSequence](http://hl7.org/fhir/StructureDefinition/MolecularSequence) v5.0.0**

 Representation of a molecular sequence

 Representation of a molecular 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 = "MolecularSequenceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MolecularSequenceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MolecularSequence::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MolecularSequence", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 A unique identifier for this particular sequence 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>>,
    /** **[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<codes::SequenceType>,
    /// 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 this sequence is associated too**

 Indicates the subject this sequence is associated too.

 */
    #[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>,
    /** **What the molecular sequence is about, when it is not about the subject of record**

 The actual focus of a molecular sequence when it is not the patient of record representing something or someone associated with the patient such as a spouse, parent, child, or sibling. For example, in trio testing, the subject would be the child (proband) and the focus would be the parent.

 */
    #[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>>,
    /** **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>,
    /** **Sequence that was observed**

 Sequence that was observed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "literal")]
    pub literal: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_literal")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub literal_ext: Option<FieldExtension>,
    /** **Embedded file or a link (URL) which contains content to represent the sequence**

 Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "formatted")]
    pub formatted: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_formatted")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub formatted_ext: Vec<Option<FieldExtension>>,
    /** **A sequence defined relative to another sequence**

 A sequence defined relative to another sequence.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relative")]
    pub relative: Vec<Option<MolecularSequenceRelative>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relative")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relative_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MolecularSequenceBuilder {
    #[doc = concat!("Finalize building ", "MolecularSequence", ".")]
    pub fn build(self) -> Result<MolecularSequence, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MolecularSequenceInner> for MolecularSequence {
    fn from(inner: MolecularSequenceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MolecularSequence {
    type Target = MolecularSequenceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MolecularSequence {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MolecularSequence {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MolecularSequenceBuilder {
        MolecularSequenceBuilder::default()
    }
}
impl MolecularSequence {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MolecularSequence
    }
}
/// Sub-fields of the relative field in MolecularSequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MolecularSequenceRelativeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MolecularSequenceRelative {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[LL5323-2](http://loinc.org/LL5323-2/); Ways of identifying nucleotides or amino acids within a sequence**

 These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.

 */
    #[serde(rename = "coordinateSystem")]
    pub coordinate_system: CodeableConcept,
    /// 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>,
    /** **Indicates the order in which the sequence should be considered when putting multiple 'relative' elements together**

 Indicates the order in which the sequence should be considered when putting multiple 'relative' elements together.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ordinalPosition")]
    pub ordinal_position: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ordinalPosition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ordinal_position_ext: Option<FieldExtension>,
    /** **Indicates the nucleotide range in the composed sequence when multiple 'relative' elements are used together**

 Indicates the nucleotide range in the composed sequence when multiple 'relative' elements are used together.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceRange")]
    pub sequence_range: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceRange")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_range_ext: Option<FieldExtension>,
    /** **A sequence used as starting sequence**

 A sequence that is used as a starting sequence 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 = "startingSequence")]
    pub starting_sequence: Option<MolecularSequenceRelativeStartingSequence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_startingSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub starting_sequence_ext: Option<FieldExtension>,
    /** **Changes in sequence from the starting sequence**

 Changes in sequence from the starting sequence.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "edit")]
    pub edit: Vec<Option<MolecularSequenceRelativeEdit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_edit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub edit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MolecularSequenceRelative {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MolecularSequenceRelativeBuilder {
        MolecularSequenceRelativeBuilder::default()
    }
}
/// Sub-fields of the startingSequence field in MolecularSequenceRelative
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MolecularSequenceRelativeStartingSequenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MolecularSequenceRelativeStartingSequence {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[LL1040-6](http://loinc.org/LL1040-6/); The genome assembly used for starting sequence, e.g. GRCh38**

 The genome assembly used for starting sequence, e.g. GRCh38.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genomeAssembly")]
    pub genome_assembly: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_genomeAssembly")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub genome_assembly_ext: Option<FieldExtension>,
    /** **[LL2938-0](http://loinc.org/LL2938-0/); Chromosome Identifier**

 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 reference sequence that represents the starting sequence**

 The reference sequence that represents the starting sequence.

 A starting sequence may be represented in one of three ways:
  1.  CodeableConcept, using NCBI, LRG or other appropriate code systems
  1.  a simple string of IUPAC codes
  1.  a reference to another MolecularSequence resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub sequence: Option<MolecularSequenceRelativeStartingSequenceSequence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<MolecularSequenceRelativeStartingSequenceSequenceExtension>,
    /** **Start position of the window on the starting sequence**

 Start position of the window on the starting sequence. This value should honor the rules of the coordinateSystem.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "windowStart")]
    pub window_start: Option<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 starting sequence**

 End position of the window on the starting sequence. This value should honor the rules of the  coordinateSystem.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "windowEnd")]
    pub window_end: Option<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>,
    /** **[orientationType](http://hl7.org/fhir/ValueSet/orientation-type); sense | antisense**

 A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orientation")]
    pub orientation: Option<codes::OrientationType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orientation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub orientation_ext: Option<FieldExtension>,
    /** **[strandType](http://hl7.org/fhir/ValueSet/strand-type); watson | crick**

 An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "strand")]
    pub strand: Option<codes::StrandType>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl MolecularSequenceRelativeStartingSequence {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MolecularSequenceRelativeStartingSequenceBuilder {
        MolecularSequenceRelativeStartingSequenceBuilder::default()
    }
}
/// Choice of types for the sequence[x] field in MolecularSequenceRelativeStartingSequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MolecularSequenceRelativeStartingSequenceSequence {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "sequenceCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "sequenceString")]
    String(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "sequenceReference")]
    Reference(Reference),
}
/// Extension value for MolecularSequenceRelativeStartingSequenceSequence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MolecularSequenceRelativeStartingSequenceSequenceExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_sequenceCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_sequenceString")]
    String(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sequenceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the edit field in MolecularSequenceRelative
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MolecularSequenceRelativeEditBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MolecularSequenceRelativeEdit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 edit on the starting sequence**

 Start position of the edit on the starting 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 edit on the starting sequence**

 End position of the edit on the starting sequence. If the coordinate system is 0-based then end 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**

 Allele that was observed. 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 = "replacementSequence")]
    pub replacement_sequence: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_replacementSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub replacement_sequence_ext: Option<FieldExtension>,
    /** **Allele in the starting sequence**

 Allele in the starting sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the starting 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 = "replacedSequence")]
    pub replaced_sequence: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_replacedSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub replaced_sequence_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MolecularSequenceRelativeEdit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MolecularSequenceRelativeEditBuilder {
        MolecularSequenceRelativeEditBuilder::default()
    }
}
/** 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.

 **[NamingSystem](http://hl7.org/fhir/StructureDefinition/NamingSystem) v5.0.0**

 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>);
/** 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.

 **[NamingSystem](http://hl7.org/fhir/StructureDefinition/NamingSystem) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this naming system, represented as a URI (globally unique)**

 An absolute URI that is used to identify this naming system when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this naming system is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the naming system is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 naming system (business identifier)**

 A formal identifier that is used to identify this naming 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, and can then identify this naming system 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 naming system**

 The identifier that is used to identify this version of the naming system when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the naming 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.

 There may be different naming system instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the naming system with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which NamingSystem is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<NamingSystemVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<NamingSystemVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Title for this naming system (human friendly)**

 A short, descriptive, user-friendly title for the naming system.

 This title 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 naming system. Enables tracking the life-cycle of the content.

 Allows filtering of naming systems that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **For testing purposes, not real usage**

 A Boolean value to indicate that this naming system is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of naming systems that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the naming system was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[NamingSystemIdentifierSystemType](http://hl7.org/fhir/ValueSet/namingsystem-identifier-system-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 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 naming system is presumed to be the predominant language in the place the naming system 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate naming system instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 naming system is defined**

 Explanation of why this naming 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 naming system and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the naming system.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the NamingSystem 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 NamingSystem was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 NamingSystem is expected to be used**

 The period during which the NamingSystem content was or is planned to be in active use.

 The effective period for a NamingSystem determines when the content is applicable for usage and is independent of publication and review dates. For example, a NamingSystem intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptions related to the content of the NamingSystem. Topics provide a high-level categorization as well as keywords for the NamingSystem that can be useful for filtering and searching.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the CodeSystem**

 An individiual or organization primarily involved in the creation and maintenance of the NamingSystem.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the NamingSystem**

 An individual or organization primarily responsible for internal coherence of the NamingSystem.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the NamingSystem**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the NamingSystem.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the NamingSystem**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the NamingSystem for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, dependencies, bibliographic references, and predecessor and successor artifacts.

 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>>,
    /** **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>>,
}
#[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
    }
}
/// Choice of types for the versionAlgorithm[x] field in NamingSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NamingSystemVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for NamingSystemVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NamingSystemVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | iri-stem | v2csmnemonic | 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. Preferred identifiers for the same identifier type SHOULD NOT overlap by period. */
    #[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).

The nuance of identifier deprecation is not represented with a separate element. When a determination is made that an identifier should not be used, the validity period end date is updated with the date the identifier is deemed to be deprecated. The identifier should no longer be used once the period end date is reached. */
    #[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>,
    /** **Whether the identifier is authoritative**

 Indicates whether this identifier ie endorsed by the official owner of the associated naming system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoritative")]
    pub authoritative: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoritative")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authoritative_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NamingSystemUniqueId {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NamingSystemUniqueIdBuilder {
        NamingSystemUniqueIdBuilder::default()
    }
}
/** A record of food or fluid that is being consumed by a patient.  A NutritionIntake may indicate that the patient may be consuming the food or fluid now or has consumed the food or fluid in the past.  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 or through an app that tracks food or fluids consumed.   The consumption information may come from sources such as the patient's memory, from a nutrition label,  or from a clinician documenting observed intake.

 **[NutritionIntake](http://hl7.org/fhir/StructureDefinition/NutritionIntake) v5.0.0**

 Record of food or fluid being taken by a patient

 A record of food or fluid that is being consumed by a patient.   A NutritionIntake may indicate that the patient may be consuming the food or fluid now or has consumed the food or fluid in the past.  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 or through an app that tracks food or fluids consumed.   The consumption information may come from sources such as the patient's memory, from a nutrition label,  or from a clinician documenting observed intake.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct NutritionIntake(pub Box<NutritionIntakeInner>);
/** A record of food or fluid that is being consumed by a patient.  A NutritionIntake may indicate that the patient may be consuming the food or fluid now or has consumed the food or fluid in the past.  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 or through an app that tracks food or fluids consumed.   The consumption information may come from sources such as the patient's memory, from a nutrition label,  or from a clinician documenting observed intake.

 **[NutritionIntake](http://hl7.org/fhir/StructureDefinition/NutritionIntake) v5.0.0**

 Record of food or fluid being taken by a patient

 A record of food or fluid that is being consumed by a patient.   A NutritionIntake may indicate that the patient may be consuming the food or fluid now or has consumed the food or fluid in the past.  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 or through an app that tracks food or fluids consumed.   The consumption information may come from sources such as the patient's memory, from a nutrition label,  or from a clinician documenting observed intake.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionIntakeBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct NutritionIntakeInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "NutritionIntake::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::NutritionIntake", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Identifiers associated with this Nutrition Intake 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. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource 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>>,
    /** **Instantiates FHIR protocol or definition**

 Instantiates FHIR protocol or definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 Instantiates external protocol or definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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>>,
    /** **[NutritionIntakeStatus](http://hl7.org/fhir/ValueSet/event-status); preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown**

 A code representing the patient or other source's judgment about the state of the intake that this assertion is about.  Generally, this will be active or completed.

 NutritionIntake is a statement at a point in time.  The status is only representative at the point when it was asserted.  The value set for NutritionIntake.status contains codes that assert the status of the consumption of the food or fluid by the patient (for example, stopped or on hold) as well as codes that assert the status of the Nutrition Intake 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::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>,
    /** **[NutritionIntakeStatusReason](http://hl7.org/fhir/ValueSet/clinicalimpression-status-reason); Reason for current status**

 Captures the reason for the current state of the NutritionIntake.

 This is generally only used for "exception" statuses such as "not-taken", "on-hold", "cancelled" or "entered-in-error". The reason for performing the event at all is captured in reasonCode, not here. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_reason_ext: Vec<Option<FieldExtension>>,
    /** **[NutritionIntakeCategory](http://hl7.org/fhir/ValueSet/diet-type); Code representing an overall type of nutrition intake**

 Overall type of nutrition intake.

 */
    #[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 is/was consuming the food or fluid**

 The person, animal or group who is/was consuming the food or fluid.

 */
    #[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 associated with NutritionIntake**

 The encounter that establishes the context for this NutritionIntake.

 */
    #[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>,
    /** **The date/time or interval when the food or fluid is/was consumed**

 The interval of time during which it is being asserted that the patient is/was consuming the food or fluid.

 This attribute reflects the period over which the patient consumed the food fluid and is expected to be populated on the majority of NutritionIntake. If the food or fluid is still being taken and is expected to continue indefinitely at the time the usage is recorded, the "end" date will be omitted.  If the end date is known, then it is included as the "end date".  The date/time attribute supports a variety of dates - year, year/month and exact date.  If something more than this is required, this should be conveyed as text. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<NutritionIntakeOccurrence>,
    /// 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<NutritionIntakeOccurrenceExtension>,
    /** **When the intake was recorded**

 The date when the Nutrition Intake 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 = "recorded")]
    pub recorded: Option<DateTime>,
    /// 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>,
    /** **Person or organization that provided the information about the consumption of this food or fluid**

 The person or organization that provided the information about the consumption of this food or fluid. Note: Use derivedFrom when a NutritionIntake is derived from other resources.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reported: Option<NutritionIntakeReported>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reported_ext: Option<NutritionIntakeReportedExtension>,
    /** **What food or fluid product or item was consumed**

 What food or fluid product or item was consumed.

 */
    #[serde(rename = "consumedItem")]
    pub consumed_item: Vec<Option<NutritionIntakeConsumedItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_consumedItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub consumed_item_ext: Vec<Option<FieldExtension>>,
    /** **Total nutrient for the whole meal, product, serving**

 Total nutrient amounts for the whole meal, product, serving, etc.

 Individual item nutrients are not currently included in the resource and will likely end up as a reference in nutritionProduct to represent the individual items. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredientLabel")]
    pub ingredient_label: Vec<Option<NutritionIntakeIngredientLabel>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_ingredientLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub ingredient_label_ext: Vec<Option<FieldExtension>>,
    /** **Who was performed in the intake**

 Who performed the intake and how they were involved.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<NutritionIntakePerformer>>,
    /// 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 intake occurred**

 Where the intake 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>,
    /** **Additional supporting information**

 Allows linking the NutritionIntake to the underlying NutritionOrder, or to other information, such as AllergyIntolerance, that supports or is used to derive the NutritionIntake.

 Likely references would be to AllergyIntolerance,  Observation or QuestionnaireAnswers. */
    #[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>>,
    /** **[IntakeReason](http://hl7.org/fhir/ValueSet/condition-code); Reason for why the food or fluid is /was consumed**

 A reason, Condition or observation for why the food or fluid is /was consumed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Further information about the consumption**

 Provides extra information about the Nutrition Intake 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>>,
}
#[cfg(feature = "builders")]
impl NutritionIntakeBuilder {
    #[doc = concat!("Finalize building ", "NutritionIntake", ".")]
    pub fn build(self) -> Result<NutritionIntake, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<NutritionIntakeInner> for NutritionIntake {
    fn from(inner: NutritionIntakeInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for NutritionIntake {
    type Target = NutritionIntakeInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for NutritionIntake {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl NutritionIntake {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> NutritionIntakeBuilder {
        NutritionIntakeBuilder::default()
    }
}
impl NutritionIntake {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::NutritionIntake
    }
}
/// Choice of types for the occurrence[x] field in NutritionIntake
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionIntakeOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
}
/// Extension value for NutritionIntakeOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionIntakeOccurrenceExtension {
    /// 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 reported[x] field in NutritionIntake
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionIntakeReported {
    /// Variant accepting the Boolean type.
    #[serde(rename = "reportedBoolean")]
    Boolean(bool),
    /// Variant accepting the Reference type.
    #[serde(rename = "reportedReference")]
    Reference(Reference),
}
/// Extension value for NutritionIntakeReported.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionIntakeReportedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_reportedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reportedReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the consumedItem field in NutritionIntake
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionIntakeConsumedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionIntakeConsumedItem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FoodType](http://hl7.org/fhir/ValueSet/edible-substance-type); The type of food or fluid product**

 Indicates what a category of item that was consumed: e.g., food, fluid, enteral, 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>,
    /** **[FoodProduct](http://hl7.org/fhir/ValueSet/food-type); Code that identifies the food or fluid product that was consumed**

 Identifies the food or fluid product that was consumed. This is potentially a link to a resource representing the details of the food product (TBD) or a simple attribute carrying a code that identifies the food from a known list of foods.

 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 a new nutritionProduct resource is recommended. */
    #[serde(rename = "nutritionProduct")]
    pub nutrition_product: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nutritionProduct")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub nutrition_product_ext: Option<FieldExtension>,
    /** **Scheduled frequency of consumption**

 Scheduled frequency of consumption.

 */
    #[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>,
    /** **Quantity of the specified food**

 Quantity of the specified food.

 */
    #[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>,
    /** **Rate at which enteral feeding was administered**

 Rate at which enteral feeding was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rate")]
    pub rate: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rate_ext: Option<FieldExtension>,
    /** **Flag to indicate if the food or fluid item was refused or otherwise not consumed**

 Indicator when a patient is in a setting where it is helpful to know if food was not consumed, such as it was refused, held (as in tube feedings), or otherwise not provided. If a consumption is being recorded from an app, such as MyFitnessPal, this indicator will likely not be used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notConsumed")]
    pub not_consumed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notConsumed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_consumed_ext: Option<FieldExtension>,
    /** **[NotConsumedReason](http://hl7.org/fhir/ValueSet/not-consumed-reason); Reason food or fluid was not consumed**

 Document the reason the food or fluid was not consumed, such as refused, held, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notConsumedReason")]
    pub not_consumed_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notConsumedReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_consumed_reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionIntakeConsumedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionIntakeConsumedItemBuilder {
        NutritionIntakeConsumedItemBuilder::default()
    }
}
/// Sub-fields of the ingredientLabel field in NutritionIntake
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionIntakeIngredientLabelBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionIntakeIngredientLabel {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NutrientType](http://hl7.org/fhir/ValueSet/nutrient-code); Total nutrient consumed**

 Total nutrient consumed. This could be a macronutrient (protein, fat, carbohydrate), or a vitamin and mineral.

 */
    #[serde(rename = "nutrient")]
    pub nutrient: CodeableReference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nutrient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub nutrient_ext: Option<FieldExtension>,
    /** **Total amount of nutrient consumed**

 Total amount of nutrient consumed.

 */
    #[serde(rename = "amount")]
    pub amount: 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 NutritionIntakeIngredientLabel {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionIntakeIngredientLabelBuilder {
        NutritionIntakeIngredientLabelBuilder::default()
    }
}
/// Sub-fields of the performer field in NutritionIntake
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionIntakePerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionIntakePerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NutritionPerformerType](http://hl7.org/fhir/ValueSet/performer-role); Type of performer**

 Type of performer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who performed the intake**

 Who performed the intake.

 */
    #[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 NutritionIntakePerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionIntakePerformerBuilder {
        NutritionIntakePerformerBuilder::default()
    }
}
/** A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.

 **[NutritionOrder](http://hl7.org/fhir/StructureDefinition/NutritionOrder) v5.0.0**

 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>);
/** A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.

 **[NutritionOrder](http://hl7.org/fhir/StructureDefinition/NutritionOrder) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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](servicerequest.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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance number. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.

 */
    #[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>>,
    /** **What this order fulfills**

 A plan or request that is fulfilled in whole or in part by this nutrition order.

 */
    #[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 ID**

 A shared identifier common to all nutrition orders that were authorized more or less simultaneously by a single author, representing the composite or group identifier.

 */
    #[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>,
    /** **[NutritionOrderStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | on-hold | revoked | completed | entered-in-error | unknown**

 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(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>,
    /** **[NutritiionOrderIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.

 When resources map to this element, they are free to define as many codes as necessary to cover their space and will map to "proposal, plan or order".  Can have multiple codes that map to one of these.  E.g. "original order", "encoded order", "reflex order" would all map to "order".  Expectation is that the set of codes is mutually exclusive or a strict all-encompassing hierarchy. */
    #[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>,
    /** **[NutritionOrderPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the Nutrition Order 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 requires the diet, formula or nutritional supplement**

 The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.

 */
    #[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 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>,
    /** **Information to support fulfilling of the nutrition order**

 Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight).

 */
    #[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>>,
    /** **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>,
    /** **Who is desired to perform the administration of what is being ordered**

 The specified desired performer of the nutrition order.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **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 modifier about the type of oral food or oral fluids 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>>,
    /** **Capture when a food item is brought in by the patient and/or family**

 This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outsideFoodAllowed")]
    pub outside_food_allowed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outsideFoodAllowed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outside_food_allowed_ext: 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>,
    /** **Comments**

 Comments made about the {{title}} by the requester, performer, subject or other participants.

 This element SHALL NOT be used to supply free text instructions for the diet which are represented in the `.oralDiet.instruction`, `supplement.instruction`, or `enteralFormula.administrationInstruction` elements. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Scheduling information for oral diets**

 Schedule information for an oral diet.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Option<NutritionOrderOralDietSchedule>,
    /// 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>,
    /** **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 schedule 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 = "NutritionOrderOralDietScheduleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderOralDietSchedule {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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 = "timing")]
    pub timing: Vec<Option<Timing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_timing")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub timing_ext: Vec<Option<FieldExtension>>,
    /** **Take 'as needed'**

 Indicates whether the product is only taken when needed within a specific dosing schedule.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeeded")]
    pub as_needed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeeded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_ext: Option<FieldExtension>,
    /** **[OralDietAsNeededReason](http://hl7.org/fhir/ValueSet/medication-as-needed-reason); Take 'as needed' for x**

 Indicates whether the product is only taken based on a precondition for taking the product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeededFor")]
    pub as_needed_for: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeededFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_for_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderOralDietSchedule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderOralDietScheduleBuilder {
        NutritionOrderOralDietScheduleBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 `texture.modifier`; 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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<CodeableReference>,
    /// 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>,
    /** **Scheduling information for supplements**

 Schedule information for a supplement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Option<NutritionOrderSupplementSchedule>,
    /// 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>,
    /** **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 schedule field in NutritionOrderSupplement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderSupplementScheduleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderSupplementSchedule {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 diet**

 The time period and frequency at which the supplement 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 = "timing")]
    pub timing: Vec<Option<Timing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_timing")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub timing_ext: Vec<Option<FieldExtension>>,
    /** **Take 'as needed'**

 Indicates whether the supplement is only taken when needed within a specific dosing schedule.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeeded")]
    pub as_needed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeeded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_ext: Option<FieldExtension>,
    /** **[SupplementAsNeededReason](http://hl7.org/fhir/ValueSet/medication-as-needed-reason); Take 'as needed' for x**

 Indicates whether the supplement is only taken based on a precondition for taking the supplement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeededFor")]
    pub as_needed_for: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeededFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_for_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderSupplementSchedule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderSupplementScheduleBuilder {
        NutritionOrderSupplementScheduleBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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<CodeableReference>,
    /// 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>,
    /** **Intended type of device for the administration**

 The intended type of device that is to be used for the administration of the enteral formula.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deliveryDevice")]
    pub delivery_device: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_deliveryDevice")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub delivery_device_ext: Vec<Option<FieldExtension>>,
    /** **Components to add to the feeding**

 Indicates modular components to be provided in addition or mixed with the base formula.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additive")]
    pub additive: Vec<Option<NutritionOrderEnteralFormulaAdditive>>,
    /// 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>>,
    /** **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 route_of_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 route_of_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 additive 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 = "NutritionOrderEnteralFormulaAdditiveBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderEnteralFormulaAdditive {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[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 = "type")]
    pub r#type: Option<CodeableReference>,
    /// 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 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 = "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>,
    /** **Amount of additive to be given or mixed in**

 The amount of additive to be given in addition or to be mixed in with the base formula.

 */
    #[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 NutritionOrderEnteralFormulaAdditive {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderEnteralFormulaAdditiveBuilder {
        NutritionOrderEnteralFormulaAdditiveBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Scheduling information for enteral formula products**

 Schedule information for an enteral formula.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Option<NutritionOrderEnteralFormulaAdministrationSchedule>,
    /// 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()
    }
}
/// Sub-fields of the schedule field in NutritionOrderEnteralFormulaAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderEnteralFormulaAdministrationScheduleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderEnteralFormulaAdministrationSchedule {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 formula**

 The time period and frequency at which the enteral formula should be given.  The enteral formula 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 = "timing")]
    pub timing: Vec<Option<Timing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_timing")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub timing_ext: Vec<Option<FieldExtension>>,
    /** **Take 'as needed'**

 Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeeded")]
    pub as_needed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeeded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_ext: Option<FieldExtension>,
    /** **[EnteralFormulaAsNeededReason](http://hl7.org/fhir/ValueSet/medication-as-needed-reason); Take 'as needed' for x**

 Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asNeededFor")]
    pub as_needed_for: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asNeededFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_for_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderEnteralFormulaAdministrationSchedule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderEnteralFormulaAdministrationScheduleBuilder {
        NutritionOrderEnteralFormulaAdministrationScheduleBuilder::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),
}
/** A food or supplement that is consumed by patients.

 **[NutritionProduct](http://hl7.org/fhir/StructureDefinition/NutritionProduct) v5.0.0**

 A product used for nutritional purposes (i.e. food or supplement)

 A food or supplement that is consumed by patients.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct NutritionProduct(pub Box<NutritionProductInner>);
/** A food or supplement that is consumed by patients.

 **[NutritionProduct](http://hl7.org/fhir/StructureDefinition/NutritionProduct) v5.0.0**

 A product used for nutritional purposes (i.e. food or supplement)

 A food or supplement that is consumed by patients.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionProductBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct NutritionProductInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "NutritionProduct::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::NutritionProduct", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NutritionProductCode](http://hl7.org/fhir/ValueSet/edible-substance-type); A code that can identify the detailed nutrients and ingredients in a specific food product**

 The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual 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>,
    /** **[NutritionProductStatus](http://hl7.org/fhir/ValueSet/nutritionproduct-status); active | inactive | entered-in-error**

 The current state of the product.

 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. */
    #[serde(rename = "status")]
    pub status: codes::NutritionProductStatus,
    /// 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>,
    /** **[NutritionProductCategory](http://hl7.org/fhir/ValueSet/nutrition-product-category); Broad product groups or categories used to classify the product, such as Legume and Legume Products, Beverages, or Beef Products**

 Nutrition products can have different classifications - according to its nutritional properties, preparation methods, 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>>,
    /** **Manufacturer, representative or officially responsible for the product**

 The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **The product's nutritional information expressed by the nutrients**

 The product's nutritional information expressed by the nutrients.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance number. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nutrient")]
    pub nutrient: Vec<Option<NutritionProductNutrient>>,
    /// 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>>,
    /** **Ingredients contained in this product**

 Ingredients contained in this product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<NutritionProductIngredient>>,
    /// 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>>,
    /** **[AllergenClass](http://hl7.org/fhir/ValueSet/allergen-class); Known or suspected allergens that are a part of this product**

 Allergens that are known or suspected to be a part of this nutrition product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "knownAllergen")]
    pub known_allergen: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_knownAllergen")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub known_allergen_ext: Vec<Option<FieldExtension>>,
    /** **Specifies descriptive properties of the nutrition product**

 Specifies descriptive properties of the nutrition product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<NutritionProductCharacteristic>>,
    /// 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>>,
    /** **One or several physical instances or occurrences of the nutrition product**

 Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<NutritionProductInstance>>,
    /// 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>>,
    /** **Comments made about the product**

 Comments made about the product.

 */
    #[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 NutritionProductBuilder {
    #[doc = concat!("Finalize building ", "NutritionProduct", ".")]
    pub fn build(self) -> Result<NutritionProduct, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<NutritionProductInner> for NutritionProduct {
    fn from(inner: NutritionProductInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for NutritionProduct {
    type Target = NutritionProductInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for NutritionProduct {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl NutritionProduct {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> NutritionProductBuilder {
        NutritionProductBuilder::default()
    }
}
impl NutritionProduct {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::NutritionProduct
    }
}
/// Sub-fields of the nutrient field in NutritionProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionProductNutrientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionProductNutrient {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NutritionProductNutrient](http://hl7.org/fhir/ValueSet/nutrition-product-nutrient); The (relevant) nutrients in the product**

 The (relevant) nutrients in the product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Option<CodeableReference>,
    /// 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>,
    /** **The amount of nutrient expressed in one or more units: X per pack / per serving / per dose**

 The amount of nutrient expressed in one or more units: X per pack / per serving / per dose.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Vec<Option<Ratio>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub amount_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl NutritionProductNutrient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionProductNutrientBuilder {
        NutritionProductNutrientBuilder::default()
    }
}
/// Sub-fields of the ingredient field in NutritionProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionProductIngredientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionProductIngredient {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 ingredient contained in the product**

 The ingredient contained in the product.

 */
    #[serde(rename = "item")]
    pub item: CodeableReference,
    /// 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>,
    /** **The amount of ingredient that is in the product**

 The amount of ingredient that is in the product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Vec<Option<Ratio>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub amount_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl NutritionProductIngredient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionProductIngredientBuilder {
        NutritionProductIngredientBuilder::default()
    }
}
/// Sub-fields of the characteristic field in NutritionProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionProductCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionProductCharacteristic {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PropertyCharacteristic](http://hl7.org/fhir/ValueSet/measurement-property); Code specifying the type of characteristic**

 A code specifying which characteristic of the product is being described (for example, colour, shape).

 */
    #[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>,
    /** **The value of the characteristic**

 The actual characteristic value corresponding to the type.

 The description should be provided as a CodeableConcept, SimpleQuantity or an image.  The description can be a string only when these others are not available. */
    #[serde(flatten)]
    pub value: NutritionProductCharacteristicValue,
    /// 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<NutritionProductCharacteristicValueExtension>,
}
#[cfg(feature = "builders")]
impl NutritionProductCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionProductCharacteristicBuilder {
        NutritionProductCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in NutritionProductCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionProductCharacteristicValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
}
/// Extension value for NutritionProductCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionProductCharacteristicValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
}
/// Sub-fields of the instance field in NutritionProduct
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionProductInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionProductInstance {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 amount of items or instances**

 The amount of items or instances that the resource considers, for instance when referring to 2 identical units together.

 */
    #[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>,
    /** **The identifier for the physical instance, typically a serial number or manufacturer number**

 The identifier for the physical instance, typically a serial number or manufacturer 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>>,
    /** **The name for the specific product**

 The name for the specific product.

 */
    #[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 identification of the batch or lot of the product**

 The identification of the batch or lot of the 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>,
    /** **The expiry date or date and time for the product**

 The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.

 */
    #[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>,
    /** **The date until which the product is expected to be good for consumption**

 The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useBy")]
    pub use_by: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_useBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub use_by_ext: Option<FieldExtension>,
    /** **An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled**

 An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.

 Necessary to support mandatory requirements for traceability from donor/source to recipient and vice versa, while also satisfying donor anonymity requirements. The element is defined consistently across BiologicallyDerivedProduct, NutritionProduct, and Device.  The identifier references an event that links to a single biological entity such as a blood donor, or to multiple biological entities (e.g. when the product is an embryo or a pooled platelet product).  A single biologicalSourceEvent identifier may appear on multiple products of many types derived from a single donation event or source extraction.  As an example, a single donation event may provide 2 kidneys and a liver for organ transplantation, 2 corneas for eye surgery, heart valves and arterial tissue for cardiovascular surgery, multiple skin grafts, tendons, multiple shaped bone grafts and a large number of bone putty/paste products; and each of them may be assigned to the same biological source event identifier. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "biologicalSourceEvent")]
    pub biological_source_event: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_biologicalSourceEvent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub biological_source_event_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionProductInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionProductInstanceBuilder {
        NutritionProductInstanceBuilder::default()
    }
}
/** Measurements and simple assertions made about a patient, device or other subject.

 **[Observation](http://hl7.org/fhir/StructureDefinition/Observation) v5.0.0**

 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 laboratory reports, etc. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Observation(pub Box<ObservationInner>);
/** Measurements and simple assertions made about a patient, device or other subject.

 **[Observation](http://hl7.org/fhir/StructureDefinition/Observation) v5.0.0**

 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 laboratory 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Instantiates FHIR ObservationDefinition**

 The reference to a FHIR ObservationDefinition resource that provides the definition that is adhered to in whole or in part by this Observation instance.

 ObservationDefinition can be referenced by its canonical url using instantiatesCanonical, or by a name or an identifier using the appropriate sub-elements of instantiatesReference. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub instantiates: Option<ObservationInstantiates>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_ext: Option<ObservationInstantiatesExtension>,
    /** **Fulfills plan, proposal or order**

 A plan, proposal or order that is fulfilled in whole or in part by this event.  For example, a MedicationRequest may require a patient to have laboratory test performed before  it is dispensed.

 */
    #[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>>,
    /** **Triggering observation(s)**

 Identifies the observation(s) that triggered the performance of this observation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "triggeredBy")]
    pub triggered_by: Vec<Option<ObservationTriggeredBy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_triggeredBy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub triggered_by_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced event**

 A larger event of which this particular Observation is a component or step.  For example,  an observation as part of a procedure.

 To link an Observation to an Encounter use `encounter`.  See the  [Notes](observation.html#obsgrouping) below for guidance on referencing another Observation. */
    #[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>>,
    /** **[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".

 *All* code-value and, if present, component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation. */
    #[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 the observation is about**

 The patient, or group of patients, location, device, organization, procedure or practitioner this observation is about and into whose or what record the observation is placed. If the actual focus of the observation is different from the subject (or a sample of, part, or region of the subject), the `focus` element or the `code` itself specifies the actual focus of the observation.

 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. The subject of an Observation may in some cases be a procedure.  This supports the regulatory inspection use case where observations are captured during inspections of a procedure that is being performed (independent of any particular patient or whether patient related at all). */
    #[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>,
    /** **What the observation is about, when it is not about the subject of record**

 The actual focus of an observation when it is not the patient of record representing something or someone associated with the patient such as a spouse, parent, fetus, or donor. For example, fetus observations in a mother's record.  The focus of an observation could also be an existing condition,  an intervention, the subject's diet,  another observation of the subject,  or a body structure such as tumor or implanted device.   An example use case would be using the Observation resource to capture whether the mother is trained to change her child's tracheostomy tube. In this example, the child is the patient of record and the mother is the focus.

 Typically, an observation is made about the subject - a patient, or group of patients, location, or device - and the distinction between the subject and what is directly measured for an observation is specified in the observation code itself ( e.g., "Blood Glucose") and does not need to be represented separately using this element.  Use `specimen` if a reference to a specimen is required.  If a code is required instead of a resource use either  `bodysite` for bodysites or the standard extension [http://hl7.org/fhir/StructureDefinition/observation-focusCode](http://hl7.org/fhir/extensions/StructureDefinition-observation-focusCode.html). */
    #[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>>,
    /** **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 but still be tied to the context of the encounter (e.g. pre-admission laboratory tests). */
    #[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>,
    /** **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.  For recording imprecise or "fuzzy" times (For example, a blood glucose measurement taken "after breakfast") use the [Timing](datatypes.html#timing) datatype which allow the measurement to be tied to regular life events. */
    #[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 version was made available**

 The date and time this version of the observation was made available to providers, typically after the results have been reviewed and verified.

 For Observations that don't require review and verification, it may be the same as the [`lastUpdated` ](resource-definitions.html#Meta.lastUpdated) time of the resource itself.  For Observations that do require review and verification for certain updates, it might not be the same as the `lastUpdated` time of the resource itself due to a non-clinically significant update that doesn't require the new version to be reviewed and verified again. */
    #[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.

 - An observation may have:
  1.  a single value here
  1.  both a value and a set of related or component values
  1.  only a set of related or component values.
-  If a value is present, the datatype for this element should be determined by the `code`.
-  *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 `code` defines a coded value.
-  *Attachment* is used if the observation result value is a binary file such as an image.  If the observation result value is derived from the binary file (for example 'X' detected and here is the the proof in this image), the binary file may be directly represented using *DocumentReference* and referenced by `derivedFrom`.
- The usage of valueReference is restricted to the MolecularSequence resource when used as a definitional resource, not as a patient-specific finding. .
- For additional guidance, 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/data-absent-reason); 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**

 A categorical assessment of an observation value.  For example, high, low, normal.

 Historically used for laboratory results (known as 'abnormal flag' ),  its use extends to other use cases where coded interpretations  are relevant.  Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interpretation")]
    pub interpretation: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interpretation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interpretation_ext: Vec<Option<FieldExtension>>,
    /** **Comments about the observation**

 Comments about the observation or the results.

 May include general statements about the observation, or statements about significant, unexpected or unreliable results values, or information about its source when relevant to its interpretation. */
    #[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>>,
    /** **[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. */
    #[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>,
    /** **Observed body structure**

 Indicates the body structure 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 or bodySite is used. In many systems, this may be represented as a related observation instead of an inline component. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodyStructure")]
    pub body_structure: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodyStructure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_structure_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>,
    /** **A reference to the device that generates the measurements or the device settings for the device**

 A reference to the device that generates the measurements or the device settings for the device.

 Note that this is not meant to represent a device involved in the transmission of the result, e.g., a gateway.  Such devices may be documented using the Provenance resource where relevant. */
    #[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.  Multiple reference ranges are interpreted as an "OR".   In other words, to represent two distinct target populations, two `referenceRange` elements would be used.

 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 might 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>>,
    /** **Related resource that belongs to the Observation group**

 This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.

 When using this element, an observation will typically have either a value or a set of related resources, although both may be present in some cases.  For a discussion on the ways Observations can assembled in groups together, see [Notes](observation.html#obsgrouping) below.  Note that a system may calculate results from [QuestionnaireResponse](questionnaireresponse.html)  into a final score and represent the score as an Observation. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasMember")]
    pub has_member: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_hasMember")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub has_member_ext: Vec<Option<FieldExtension>>,
    /** **Related resource from which the observation is made**

 The target resource that represents a measurement from which this observation value is derived. For example, a calculated anion gap or a fetal measurement based on an ultrasound image.

 All the reference choices that are listed in this element can represent clinical observations and other measurements that may be the source for a derived value.  The most common reference will be another Observation.  For a discussion on the ways Observations can assembled in groups together, see [Notes](observation.html#obsgrouping) below. */
    #[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>>,
    /** **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 instantiates[x] field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationInstantiates {
    /// Variant accepting the Canonical type.
    #[serde(rename = "instantiatesCanonical")]
    Canonical(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "instantiatesReference")]
    Reference(Reference),
}
/// Extension value for ObservationInstantiates.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationInstantiatesExtension {
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_instantiatesCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_instantiatesReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the triggeredBy 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 = "ObservationTriggeredByBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationTriggeredBy {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Triggering observation**

 Reference to the triggering observation.

 */
    #[serde(rename = "observation")]
    pub observation: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observation_ext: Option<FieldExtension>,
    /** **[TriggeredByType](http://hl7.org/fhir/ValueSet/observation-triggeredbytype); reflex | repeat | re-run**

 The type of trigger.
Reflex | Repeat | Re-run.

 */
    #[serde(rename = "type")]
    pub r#type: codes::TriggeredBytype,
    /// 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>,
    /** **Reason that the observation was triggered**

 Provides the reason why this observation was performed as a result of the observation(s) referenced.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<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>,
}
#[cfg(feature = "builders")]
impl ObservationTriggeredBy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationTriggeredByBuilder {
        ObservationTriggeredByBuilder::default()
    }
}
/// 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),
    /// Variant accepting the Timing type.
    #[serde(rename = "effectiveTiming")]
    Timing(Timing),
    /// Variant accepting the Instant type.
    #[serde(rename = "effectiveInstant")]
    Instant(Instant),
}
/// 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),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_effectiveTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Instant extension.
    #[serde(rename = "_effectiveInstant")]
    Instant(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 Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// 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 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),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// 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 Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(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 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),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **[ObservationReferenceRangeNormalValue](http://hl7.org/fhir/ValueSet/observation-referencerange-normalvalue); Normal value, if relevant**

 The value of the normal value of the reference range.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "normalValue")]
    pub normal_value: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_normalValue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub normal_value_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.  Multiple `appliesTo`  are interpreted as an "AND" of the target populations.  For example, to represent a target population of African American females, both a code of female and a code for African American would be used.

 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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".

 *All* code-value and  component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation. */
    #[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.

 Used when observation has a set of component observations:
-  An observation may have both a value (e.g. an  Apgar score) and component observations (the observations from which the Apgar score was derived).
-  If a value is present, the datatype for this element should be determined by the `code`.
-  *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 `code` defines a coded value.
-  *Attachment* is used if the observation result value is a binary file such as an image.  If the observation result value is derived from the binary file (for example 'X' detected and here is the the proof in this image), the binary file may be directly represented using *DocumentReference* and referenced by `derivedFrom`.
- If a value is present, the datatype for this element should be determined by the `code`.
-  *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 `code` defines a coded value.
-  *Attachment* is used if the observation result value is a binary file such as an image.  If the observation result value is derived from the binary file (for example 'X' detected and here is the the proof in this image), the binary file may be directly represented using *DocumentReference* and referenced by `derivedFrom`.
- The usage of valueReference is restricted to the MolecularSequence resource when used as a definitional resource, not as a patient-specific finding. .
- For additional guidance, 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<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/data-absent-reason); Why the component result is missing**

 Provides a reason why the expected value in the element Observation.component.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**

 A categorical assessment of an observation value.  For example, high, low, normal.

 Historically used for laboratory results (known as 'abnormal flag' ),  its use extends to other use cases where coded interpretations  are relevant.  Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interpretation")]
    pub interpretation: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interpretation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interpretation_ext: Vec<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 might 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 Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// 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 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),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// 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 Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(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 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),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/** Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.

 **[ObservationDefinition](http://hl7.org/fhir/StructureDefinition/ObservationDefinition) v5.0.0**

 Definition of an observation

 Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.

 An instance of this resource informs the consumer of a health-related service (such as a lab diagnostic test or panel) about how the observations used or produced by this service will look like. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ObservationDefinition(pub Box<ObservationDefinitionInner>);
/** Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.

 **[ObservationDefinition](http://hl7.org/fhir/StructureDefinition/ObservationDefinition) v5.0.0**

 Definition of an observation

 Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.

 An instance of this resource informs the consumer of a health-related service (such as a lab diagnostic test or panel) about how the observations used or produced by this service will look like. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ObservationDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ObservationDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ObservationDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 canonical URL to reference this ObservationDefinition (globally unique)**

 An absolute URL that is used to identify this ObservationDefinition 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 ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred. This is the URI that will be used when making canonical references to this resource. */
    #[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 identifier of the ObservationDefinition**

 Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.

 This is a business identifier, not a resource identifier. It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types. */
    #[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 ObservationDefinition**

 The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition 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 are orderable.

 There may be multiple different instances of an observationDefinition that have the same identifier but different versions. */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ObservationDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ObservationDefinitionVersionAlgorithmExtension>,
    /** **Name for this ObservationDefinition (computer friendly)**

 A natural language name identifying the ObservationDefinition. 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 alphanumeric type name to ensure that it is machine-processing 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 ObservationDefinition (human friendly)**

 A short, descriptive, user-friendly title for the ObservationDefinition.

 */
    #[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 current state of the ObservationDefinition.

 A nominal state-transition diagram can be found in the [Definition pattern](definition.html#statemachine) documentation
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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **If for testing purposes, not real usage**

 A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of ObservationDefinition that are appropriate for use vs. not. */
    #[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 last changed**

 The date (and optionally time) when the ObservationDefinition was last significantly changed. The date must change 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 ObservationDefinition changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the ObservationDefinition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 name of the individual or organization that published the ObservationDefinition**

 Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.

 */
    #[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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ObservationDefinition**

 A free text natural language description of the ObservationDefinition from the consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the module as conveyed in the text field of the resource itself. 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 = "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>,
    /** **Content intends to support these contexts**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances.

 When multiple usageContexts are specified, there is no expectation for 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 this ObservationDefinition (if applicable)**

 A jurisdiction in which the ObservationDefinition is intended to be used.

 It may be possible for the ObservationDefinition to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 ObservationDefinition is defined**

 Explains why this ObservationDefinition is needed and why it has been designed as it has.

 This element does not describe the usage of the ObservationDefinition. Rather it is for 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 ObservationDefinition. */
    #[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**

 Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When ObservationDefinition was approved by publisher**

 The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The date may be more recent than the approval date because of minor changes / editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **Date on which the asset content was last reviewed by the publisher**

 The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.

 If specified, this is usually after the approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **The effective date range for the ObservationDefinition**

 The period during which the ObservationDefinition content was or is planned to be effective.

 The effective period for an ObservationDefinition determines when the content is applicable for usage and is independent of publication and review dates. For example, an observation definition intended to be used for the year 2021 might be published in 2020.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **Based on FHIR definition of another observation**

 The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFromCanonical")]
    pub derived_from_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFromCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Based on external definition**

 The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFromUri")]
    pub derived_from_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFromUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_uri_ext: Vec<Option<FieldExtension>>,
    /** **Type of subject for the defined observation**

 A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition.

 Examples: person, animal, device, air, surface …. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **Desired kind of performer for such kind of observation**

 The type of individual/organization/device that is expected to act upon instances of this definition.

 */
    #[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>,
    /** **[ObservationCategory](http://hl7.org/fhir/ValueSet/observation-category); General type of observation**

 A code that classifies the general type of observation.

 This element allows various categorization schemes based on the owner’s definition of the category and effectively multiple categories can be used for one instance of ObservationDefinition. 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**

 Describes what will be 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>,
    /** **[ObservationDataType](http://hl7.org/fhir/ValueSet/permitted-data-type); Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period**

 The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "permittedDataType")]
    pub permitted_data_type: Vec<Option<codes::ObservationDataType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_permittedDataType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub permitted_data_type_ext: Vec<Option<FieldExtension>>,
    /** **Multiple results allowed for conforming observations**

 Multiple results allowed for observations conforming to this ObservationDefinition.

 An example of observation allowing multiple results is "bacteria identified by culture". Conversely, the measurement of a potassium level allows a single result. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "multipleResultsAllowed")]
    pub multiple_results_allowed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_multipleResultsAllowed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub multiple_results_allowed_ext: Option<FieldExtension>,
    /** **[ObservationBodySite](http://hl7.org/fhir/ValueSet/body-site); Body part to be observed**

 The site on the subject's body where the  observation is to be made.

 Only used if the defined observation is to be made directly on a body part and if this body part is not implied by code found in ObservationDefinition.code. Not used for in vitro diagnostic observations.
Example: 14975008 |Forearm structure|. */
    #[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); Method used to produce the observation**

 The method or technique used to perform the observation.

 Only used if not implicit in observation code
Example: 702659008 |Automated count technique|. */
    #[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>,
    /** **Kind of specimen used by this type of observation**

 The kind of specimen that this type of observation is produced on.

 Only used for in vitro observations. When multiple occurrences of specimen are present, they are to be combined with a logical AND: all specified specimens  are needed for the observation. */
    #[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>>,
    /** **Measurement device or model of device**

 The measurement model of device or actual device used to produce observations of this type.

 When multiple occurrences of device are present, they are to be combined with a logical OR: at least one of the specified devices is used to produce the observation. */
    #[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>>,
    /** **The preferred name to be used when reporting the observation results**

 The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preferredReportName")]
    pub preferred_report_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preferredReportName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preferred_report_name_ext: Option<FieldExtension>,
    /** **[ObservationUnit](http://hl7.org/fhir/ValueSet/ucum-units); Unit for quantitative results**

 Units allowed for the valueQuantity element in the instance observations conforming to this ObservationDefinition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "permittedUnit")]
    pub permitted_unit: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_permittedUnit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub permitted_unit_ext: Vec<Option<FieldExtension>>,
    /** **Set of qualified values for observation results**

 A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualifiedValue")]
    pub qualified_value: Vec<Option<ObservationDefinitionQualifiedValue>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_qualifiedValue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub qualified_value_ext: Vec<Option<FieldExtension>>,
    /** **Definitions of related resources belonging to this kind of observation group**

 This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasMember")]
    pub has_member: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_hasMember")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub has_member_ext: Vec<Option<FieldExtension>>,
    /** **Component results**

 Some observations have multiple component observations, expressed as separate code value pairs.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<ObservationDefinitionComponent>>,
    /// 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 ObservationDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ObservationDefinition", ".")]
    pub fn build(self) -> Result<ObservationDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ObservationDefinitionInner> for ObservationDefinition {
    fn from(inner: ObservationDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ObservationDefinition {
    type Target = ObservationDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ObservationDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ObservationDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ObservationDefinitionBuilder {
        ObservationDefinitionBuilder::default()
    }
}
impl ObservationDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ObservationDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in ObservationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ObservationDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the qualifiedValue field in ObservationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationDefinitionQualifiedValueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationDefinitionQualifiedValue {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ObservationRangeMeaning](http://hl7.org/fhir/ValueSet/referencerange-meaning); Context qualifier for the set of qualified values**

 A concept defining the context for this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<CodeableConcept>,
    /// 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>,
    /** **[ObservationRangeAppliesTo](http://hl7.org/fhir/ValueSet/referencerange-appliesto); Targetted population for the set of qualified values**

 The target population this  set of qualified values applies to.

 If this element is not present then the global 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>>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 The gender this  set of qualified values applies to.

 */
    #[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>,
    /** **Applicable age range for the set of qualified values**

 The age range this  set of qualified values applies to.

 Some analytes vary greatly over age. */
    #[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>,
    /** **Applicable gestational age range for the set of qualified values**

 The gestational age this  set of qualified values applies to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gestationalAge")]
    pub gestational_age: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gestationalAge")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gestational_age_ext: Option<FieldExtension>,
    /** **Condition associated with the set of qualified values**

 Text based condition for which the the set of qualified values is valid.

 */
    #[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>,
    /** **[ObservationRangeCategory](http://hl7.org/fhir/ValueSet/observation-range-category); reference | critical | absolute**

 The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rangeCategory")]
    pub range_category: Option<codes::ObservationRangeCategory>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rangeCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub range_category_ext: Option<FieldExtension>,
    /** **The range for continuous or ordinal observations**

 The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "range")]
    pub range: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_range")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub range_ext: Option<FieldExtension>,
    /** **Value set of valid coded values as part of this set of qualified values**

 The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validCodedValueSet")]
    pub valid_coded_value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validCodedValueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub valid_coded_value_set_ext: Option<FieldExtension>,
    /** **Value set of normal coded values as part of this set of qualified values**

 The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "normalCodedValueSet")]
    pub normal_coded_value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_normalCodedValueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub normal_coded_value_set_ext: Option<FieldExtension>,
    /** **Value set of abnormal coded values as part of this set of qualified values**

 The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "abnormalCodedValueSet")]
    pub abnormal_coded_value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_abnormalCodedValueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub abnormal_coded_value_set_ext: Option<FieldExtension>,
    /** **Value set of critical coded values as part of this set of qualified values**

 The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criticalCodedValueSet")]
    pub critical_coded_value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criticalCodedValueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub critical_coded_value_set_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ObservationDefinitionQualifiedValue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationDefinitionQualifiedValueBuilder {
        ObservationDefinitionQualifiedValueBuilder::default()
    }
}
/// Sub-fields of the component field in ObservationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationDefinitionComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationDefinitionComponent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 observation**

 Describes what will be observed.

 */
    #[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>,
    /** **[ObservationDataType](http://hl7.org/fhir/ValueSet/permitted-data-type); Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period**

 The data types allowed for the value element of the instance of this component observations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "permittedDataType")]
    pub permitted_data_type: Vec<Option<codes::ObservationDataType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_permittedDataType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub permitted_data_type_ext: Vec<Option<FieldExtension>>,
    /** **[ObservationUnit](http://hl7.org/fhir/ValueSet/ucum-units); Unit for quantitative results**

 Units allowed for the valueQuantity element in the instance observations conforming to this ObservationDefinition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "permittedUnit")]
    pub permitted_unit: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_permittedUnit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub permitted_unit_ext: Vec<Option<FieldExtension>>,
    /** **Set of qualified values for observation results**

 A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualifiedValue")]
    pub qualified_value: Vec<Option<ObservationDefinitionQualifiedValue>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_qualifiedValue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub qualified_value_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ObservationDefinitionComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationDefinitionComponentBuilder {
        ObservationDefinitionComponentBuilder::default()
    }
}
/** A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).

 **[OperationDefinition](http://hl7.org/fhir/StructureDefinition/OperationDefinition) v5.0.0**

 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>);
/** A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).

 **[OperationDefinition](http://hl7.org/fhir/StructureDefinition/OperationDefinition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this operation definition, represented as an absolute URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this operation definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the operation definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 implementation guide (business identifier)**

 A formal identifier that is used to identify this implementation guide when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **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 definitions that have the same url but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the operation definition with the format. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<OperationDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<OperationDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type no-whitespace name to ensure that it is machine-processing 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 operation definition (human friendly)**

 A short, descriptive, user-friendly title for the operation 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 current state of this operation definition.

 A nominal state-transition diagram can be found in the] documentation

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. */
    #[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 for genuine usage.

 Allows filtering of operation definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the operation definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 operation definition is presumed to be the predominant language in the place the operation definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate operation definition.

 When multiple useContexts are specified, there is no expectation that all or even 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the operation definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the operation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Whether content is changed by the operation**

 Whether the operation affects state. Side effects such as producing audit trail entries do not count as 'affecting  state'.

 What http methods can be used for the operation depends on the .affectsState value and whether the input parameters are primitive or complex:

1. Servers SHALL support POST method for all operations.

2. Servers SHALL support the GET method when the operation has affectsState = false and all required parameters for the operation are primitive. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "affectsState")]
    pub affects_state: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_affectsState")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub affects_state_ext: Option<FieldExtension>,
    /** **Recommended name for operation in search url**

 The label that is recommended to be used in the URL for this operation. In some cases, servers may need to use a different CapabilityStatement operation.name to differentiate between multiple SearchParameters that happen to have the same code.

 For maximum compatibility, use only lowercase ASCII characters. Note that HL7 will never define multiple operations with the same code. See [Naming Rules & Guidelines](https://confluence.hl7.org/display/FHIR/Guide+to+Designing+Resources#GuidetoDesigningResources-NamingRules&Guidelines) for the internal HL7 rules around codes, which are useful additional advice for all implementers */
    #[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, introduce new parameters (required or optional), 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<String>,
    /// 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/version-independent-all-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::FHIRTypes>>,
    /// 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>,
    /** **Invoke 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>,
    /** **Validation information for in parameters**

 Additional validation information for the in parameters - a single profile that covers all the parameters. The profile is a constraint on the parameters resource as a whole.

 If present the profile shall not conflict with what is specified in the parameters in the operation definition (max/min etc.), though it may provide additional constraints. The constraints expressed in the profile apply whether the operation is invoked by a POST wih parameters or not. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inputProfile")]
    pub input_profile: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inputProfile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub input_profile_ext: Option<FieldExtension>,
    /** **Validation information for out parameters**

 Additional validation information for the out parameters - a single profile that covers all the parameters. The profile is a constraint on the parameters resource.

 If present the profile shall not conflict with what is specified in the parameters in the operation definition (max/min etc.), though it may provide additional constraints. The constraints expressed in the profile apply whether the operation is invoked by a POST wih parameters or not. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outputProfile")]
    pub output_profile: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outputProfile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub output_profile_ext: Option<FieldExtension>,
    /** **Parameters for the operation/query**

 The parameters for the operation/query.

 Query Definitions only have one output parameter, named "result". This might 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in OperationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum OperationDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for OperationDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum OperationDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **[OperationParameterScope](http://hl7.org/fhir/ValueSet/operation-parameter-scope); instance | type | system**

 If present, indicates that the parameter applies when the operation is being invoked at the specified level.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Vec<Option<codes::OperationParameterScope>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub scope_ext: Vec<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/fhir-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<codes::FHIRTypes>,
    /// 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>,
    /** **[FHIRAllTypes](http://hl7.org/fhir/ValueSet/fhir-types); Allowed sub-type this parameter can have (if type is abstract)**

 Support for polymorphic types. If the parameter type is abstract, this element lists allowed sub-types for the parameter.

 In previous versions of FHIR, there was an extension for this: http://hl7.org/fhir/StructureDefinition/operationdefinition-allowed-type */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allowedType")]
    pub allowed_type: Vec<Option<codes::FHIRTypes>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_allowedType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub allowed_type_ext: Vec<Option<FieldExtension>>,
    /** **If type is Reference | canonical, allowed targets. If type is 'Resource', then this constrains the allowed resource types**

 Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this parameter refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.

 Often, these profiles are the base definitions from the spec (e.g. http://hl7.org/fhir/StructureDefinition/Patient). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetProfile")]
    pub target_profile: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_targetProfile")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_profile_ext: Vec<Option<FieldExtension>>,
    /** **[SearchParamType](http://hl7.org/fhir/ValueSet/search-param-type); number | date | string | token | reference | composite | quantity | uri | special**

 How the parameter is understood if/when it used as search parameter. This is only used if the parameter is a string.

 Parameters that are search parameter usually - but not always - are also defined for use with general searches, and function in the operation to filter the set of resources in scope for the operation just like the do when searching. The searchType describes how the server processes the value. For an example, see the [Evaluate Measure Operation](measure-operation-evaluate-measure.html) */
    #[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>,
    /** **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>,
    /** **References to this parameter**

 Identifies other resource parameters within the operation invocation that are expected to resolve to this resource.

 Resolution applies if the referenced parameter exists. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referencedFrom")]
    pub referenced_from: Vec<Option<OperationDefinitionParameterReferencedFrom>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referencedFrom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub referenced_from_ext: Vec<Option<FieldExtension>>,
    /** **Parts of a nested Parameter**

 The parts of a nested Parameter.

 Query Definitions only have one output parameter, named "result". This might 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(rename = "valueSet")]
    pub value_set: 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>,
}
#[cfg(feature = "builders")]
impl OperationDefinitionParameterBinding {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationDefinitionParameterBindingBuilder {
        OperationDefinitionParameterBindingBuilder::default()
    }
}
/// Sub-fields of the referencedFrom 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 = "OperationDefinitionParameterReferencedFromBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OperationDefinitionParameterReferencedFrom {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Referencing parameter**

 The name of the parameter or dot-separated path of parameter names pointing to the resource parameter that is expected to contain a reference to this resource.

 */
    #[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>,
    /** **Element id of reference**

 The id of the element in the referencing resource that is expected to resolve to this resource.

 */
    #[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 OperationDefinitionParameterReferencedFrom {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationDefinitionParameterReferencedFromBuilder {
        OperationDefinitionParameterReferencedFromBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** A collection of error, warning, or information messages that result from a system action.

 **[OperationOutcome](http://hl7.org/fhir/StructureDefinition/OperationOutcome) v5.0.0**

 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. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct OperationOutcome(pub Box<OperationOutcomeInner>);
/** A collection of error, warning, or information messages that result from a system action.

 **[OperationOutcome](http://hl7.org/fhir/StructureDefinition/OperationOutcome) v5.0.0**

 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. */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | success**

 Indicates whether the issue indicates a variation from successful processing.

 */
    #[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.

 Code values should align with the severity.  For example, a code of ```textforbidden``` generally wouldn't make sense with a severity of ```textinformation``` or ```textwarning```.  Similarly, a code of ```textinformational``` would generally not make sense with a severity of ```textfatal``` or ```texterror```.  However, there are no strict rules about what severities must be used with which codes.  For example, ```textcode-invalid``` might be a ```textwarning``` or ```texterror```, depending on the context */
    #[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.

 This may be a description of how a value is erroneous, a stack dump to help trace the issue or other troubleshooting information. */
    #[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>,
    /** **Deprecated: Path of element(s) related to issue**

 This element is deprecated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse.

For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child accessor 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.  This element is deprecated, and is being replaced by expression. */
    #[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 subset of FHIRPath](fhirpath.html#simple) limited to element names, repetition indicators and the default child accessor 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()
    }
}
/** 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, payer/insurer, etc.

 **[Organization](http://hl7.org/fhir/StructureDefinition/Organization) v5.0.0**

 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, payer/insurer, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Organization(pub Box<OrganizationInner>);
/** 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, payer/insurer, etc.

 **[Organization](http://hl7.org/fhir/StructureDefinition/Organization) v5.0.0**

 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, payer/insurer, 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 This active flag is not intended to be used to mark an organization 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>>,
    /** **Additional details about the Organization that could be displayed as further information to identify the Organization beyond its name**

 Description of the organization, which helps provide additional general context on the organization to ensure that the correct organization is selected.

 */
    #[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>,
    /** **Official contact details for the Organization**

 The contact details of communication devices available relevant to the specific Organization. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.

 The address/telecom use code 'home' are not to be used. Note that these contacts are not the contact details of people who provide the service (that would be through PractitionerRole), these are official contacts for the Organization itself for specific purposes. E.g. Mailing Addresses, Billing Addresses, Contact numbers for Booking or Billing Enquiries, general web address, web address for online bookings 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<ExtendedContactDetail>>,
    /// 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>>,
    /** **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>,
    /** **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>>,
    /** **Qualifications, certifications, accreditations, licenses, training, etc. pertaining to the provision of care**

 The official certifications, accreditations, training, designations and licenses that authorize and/or otherwise endorse the provision of care by the organization.

For example, an approval to provide a type of services issued by a certifying body (such as the US Joint Commission) to an organization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualification")]
    pub qualification: Vec<Option<OrganizationQualification>>,
    /// 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>>,
}
#[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 qualification 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 = "OrganizationQualificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OrganizationQualification {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 organization**

 An identifier allocated to this qualification for this organization.

 */
    #[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](); 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 OrganizationQualification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OrganizationQualificationBuilder {
        OrganizationQualificationBuilder::default()
    }
}
/** Defines an affiliation/assotiation/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship.

 **[OrganizationAffiliation](http://hl7.org/fhir/StructureDefinition/OrganizationAffiliation) v5.0.0**

 Defines an affiliation/association/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship

 Defines an affiliation/association/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct OrganizationAffiliation(pub Box<OrganizationAffiliationInner>);
/** Defines an affiliation/assotiation/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship.

 **[OrganizationAffiliation](http://hl7.org/fhir/StructureDefinition/OrganizationAffiliation) v5.0.0**

 Defines an affiliation/association/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship

 Defines an affiliation/association/relationship between 2 distinct organizations, that is not a part-of relationship/sub-division relationship.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OrganizationAffiliationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct OrganizationAffiliationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "OrganizationAffiliation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::OrganizationAffiliation", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this role**

 Business identifiers that are specific to 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 organization affiliation record is in active use**

 Whether this organization affiliation record is in active use.

 If this value is false, you may refer to the period to see when the role was in active use. If there is no period specified, no inference can be made about when it was 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>,
    /** **The period during which the participatingOrganization is affiliated with the primary organization**

 The period during which the participatingOrganization is affiliated with the primary 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>,
    /** **Organization where the role is available**

 Organization where the role is available (primary organization/has members).

 For example, a Spotless Cleaning Services (participatingOrganization) is a supplier (code) to General Hospital (organization).   Similarly, General Hospital (participatingOrganization) is a member (code) of Eastern HIE (organization).  If there are two organizations that do not have a directional relationship, there would normally be a third organization that represents the joint partnership, and the two organizations would have a relationship to that joint Organization via two OrganizationAffiliations. */
    #[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>,
    /** **Organization that provides/performs the role (e.g. providing services or is a member of)**

 The Participating Organization provides/performs the role(s) defined by the code to the Primary Organization (e.g. providing services or is a member of).

 See comments for OrganizationAffiliation.organization above. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participatingOrganization")]
    pub participating_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_participatingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub participating_organization_ext: Option<FieldExtension>,
    /** **The network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined)**

 The network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined).

 e.g. Commonly used for Health Insurance provider networks. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub network_ext: Vec<Option<FieldExtension>>,
    /** **[OrganizationAffiliation](http://hl7.org/fhir/ValueSet/organization-role); Definition of the role the participatingOrganization plays**

 Definition of the role the participatingOrganization plays in the association.

 */
    #[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>>,
    /** **[OrganizationSpecialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); Specific specialty of the participatingOrganization in the context of the role**

 Specific specialty of the participatingOrganization in the context of the role.

 */
    #[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 the role occurs**

 The location(s) at which the role occurs.

 */
    #[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>>,
    /** **Healthcare services provided through the role**

 Healthcare services provided through the role.

 */
    #[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>>,
    /** **Official contact details at the participatingOrganization relevant to this Affiliation**

 The contact details of communication devices available at the participatingOrganization relevant to this Affiliation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ExtendedContactDetail>>,
    /// 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 this role**

 Technical endpoints providing access to services operated for 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 OrganizationAffiliationBuilder {
    #[doc = concat!("Finalize building ", "OrganizationAffiliation", ".")]
    pub fn build(self) -> Result<OrganizationAffiliation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<OrganizationAffiliationInner> for OrganizationAffiliation {
    fn from(inner: OrganizationAffiliationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for OrganizationAffiliation {
    type Target = OrganizationAffiliationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for OrganizationAffiliation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl OrganizationAffiliation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> OrganizationAffiliationBuilder {
        OrganizationAffiliationBuilder::default()
    }
}
impl OrganizationAffiliation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::OrganizationAffiliation
    }
}
/** A medically related item or items, in a container or package.

 **[PackagedProductDefinition](http://hl7.org/fhir/StructureDefinition/PackagedProductDefinition) v5.0.0**

 A medically related item or items, in a container or package

 A medically related item or items, in a container or package.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PackagedProductDefinition(pub Box<PackagedProductDefinitionInner>);
/** A medically related item or items, in a container or package.

 **[PackagedProductDefinition](http://hl7.org/fhir/StructureDefinition/PackagedProductDefinition) v5.0.0**

 A medically related item or items, in a container or package

 A medically related item or items, in a container or package.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PackagedProductDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PackagedProductDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "PackagedProductDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::PackagedProductDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 unique identifier for this package as whole - not for the content of the package**

 A unique identifier for this package as whole - not the the content of the package. Unique instance identifiers assigned to a package by manufacturers, regulators, drug catalogue custodians or other organizations.

 */
    #[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 for this package. Typically as listed in a drug formulary, catalogue, inventory etc**

 A name for this package. Typically what it would be listed as in a drug formulary or catalogue, inventory 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>,
    /** **[PackageType](http://hl7.org/fhir/ValueSet/package-type); A high level category e.g. medicinal product, raw material, shipping container etc**

 A high level category e.g. medicinal product, raw material, shipping/transport container, 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 product that this is a pack for**

 The product this package model relates to, not the contents of the package (for which see package.containedItem).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageFor")]
    pub package_for: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packageFor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub package_for_ext: Vec<Option<FieldExtension>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); The status within the lifecycle of this item. High level - not intended to duplicate details elsewhere e.g. legal status, or authorization/marketing status**

 The status within the lifecycle of this item. A high level status, this is not intended to duplicate details carried elsewhere such as legal status, or authorization or marketing status.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 date at which the given status became applicable**

 The date at which the given status became applicable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<DateTime>,
    /// 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>,
    /** **A total of the complete count of contained items of a particular type/form, independent of sub-packaging or organization. This can be considered as the pack size. See also packaging.containedItem.amount (especially the long definition)**

 A total of the complete count of contained items of a particular type/form, independent of sub-packaging or organization. This can be considered as the pack size. This attribute differs from containedItem.amount in that it can give a single aggregated count of all tablet types in a pack, even when these are different manufactured items. For example a pill pack of 21 tablets plus 7 sugar tablets, can be denoted here as '28 tablets'. This attribute is repeatable so that the different item types in one pack type can be counted (e.g. a count of vials and count of syringes). Each repeat must have different units, so that it is clear what the different sets of counted items are, and it is not intended to allow different counts of similar items (e.g. not '2 tubes and 3 tubes'). Repeats are not to be used to represent different pack sizes (e.g. 20 pack vs. 50 pack) - which would be different instances of this resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "containedItemQuantity")]
    pub contained_item_quantity: Vec<Option<Quantity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_containedItemQuantity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contained_item_quantity_ext: Vec<Option<FieldExtension>>,
    /** **Textual description. Note that this is not the name of the package or product**

 Textual description. Note that this is not the name of the package or product.

 */
    #[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 legal status of supply of the packaged item as classified by the regulator**

 The legal status of supply of the packaged item as classified by the regulator.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "legalStatusOfSupply")]
    pub legal_status_of_supply: Vec<
        Option<PackagedProductDefinitionLegalStatusOfSupply>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_legalStatusOfSupply")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub legal_status_of_supply_ext: Vec<Option<FieldExtension>>,
    /** **Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated**

 Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "marketingStatus")]
    pub marketing_status: Vec<Option<MarketingStatus>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_marketingStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub marketing_status_ext: Vec<Option<FieldExtension>>,
    /** **Identifies if the drug product is supplied with another item such as a diluent or adjuvant**

 Identifies if the package contains different items, such as when a drug product is supplied with another item e.g. a diluent or adjuvant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copackagedIndicator")]
    pub copackaged_indicator: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copackagedIndicator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copackaged_indicator_ext: Option<FieldExtension>,
    /** **Manufacturer of this package type (multiple means these are all possible manufacturers)**

 Manufacturer of this package type. When there are multiple it means these are all possible manufacturers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **Additional information or supporting documentation about the packaged product**

 Additional information or supporting documentation about the packaged product.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attachedDocument")]
    pub attached_document: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attachedDocument")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attached_document_ext: Vec<Option<FieldExtension>>,
    /** **A packaging item, as a container for medically related items, possibly with other packaging items within, or a packaging component, such as bottle cap**

 A packaging item, as a container for medically related items, possibly with other packaging items within, or a packaging component, such as bottle cap (which is not a device or a medication manufactured item).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packaging")]
    pub packaging: Option<PackagedProductDefinitionPackaging>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packaging")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub packaging_ext: Option<FieldExtension>,
    /** **Allows the key features to be recorded, such as "hospital pack", "nurse prescribable"**

 Allows the key features to be recorded, such as "hospital pack", "nurse prescribable", "calendar pack".

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<PackagedProductDefinitionPackagingProperty>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl PackagedProductDefinitionBuilder {
    #[doc = concat!("Finalize building ", "PackagedProductDefinition", ".")]
    pub fn build(self) -> Result<PackagedProductDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PackagedProductDefinitionInner> for PackagedProductDefinition {
    fn from(inner: PackagedProductDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for PackagedProductDefinition {
    type Target = PackagedProductDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for PackagedProductDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl PackagedProductDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PackagedProductDefinitionBuilder {
        PackagedProductDefinitionBuilder::default()
    }
}
impl PackagedProductDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::PackagedProductDefinition
    }
}
/// Sub-fields of the legalStatusOfSupply field in PackagedProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PackagedProductDefinitionLegalStatusOfSupplyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PackagedProductDefinitionLegalStatusOfSupply {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[LegalStatusOfSupply](http://hl7.org/fhir/ValueSet/legal-status-of-supply); The actual status of supply. In what situation this package type may be supplied for use**

 The actual status of supply. Conveys in what situation this package type may be supplied for use.

 */
    #[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>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); The place where the legal status of supply applies**

 The place where the legal status of supply applies. When not specified, this indicates it is unknown in this context.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Option<CodeableConcept>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl PackagedProductDefinitionLegalStatusOfSupply {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PackagedProductDefinitionLegalStatusOfSupplyBuilder {
        PackagedProductDefinitionLegalStatusOfSupplyBuilder::default()
    }
}
/// Sub-fields of the packaging field in PackagedProductDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PackagedProductDefinitionPackagingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PackagedProductDefinitionPackaging {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 that is specific to this particular part of the packaging. Including possibly a Data Carrier Identifier**

 A business identifier that is specific to this particular part of the packaging, often assigned by the manufacturer. Including possibly Data Carrier Identifier (a GS1 barcode).

 */
    #[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>>,
    /** **[PackagingType](http://hl7.org/fhir/ValueSet/packaging-type); The physical type of the container of the items**

 The physical type of the container of the items.

 */
    #[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>,
    /** **Is this a part of the packaging (e.g. a cap or bottle stopper), rather than the packaging itself (e.g. a bottle or vial)**

 Is this a part of the packaging (e.g. a cap or bottle stopper), rather than the packaging itself (e.g. a bottle or vial). The latter type are designed be a container, but the former are not.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "componentPart")]
    pub component_part: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_componentPart")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub component_part_ext: Option<FieldExtension>,
    /** **The quantity of this level of packaging in the package that contains it (with the outermost level being 1)**

 The quantity of packaging items contained at this layer of the package. This does not relate to the number of contained items but relates solely to the number of packaging items. When looking at the outermost layer it is always 1. If there are two boxes within, at the next layer it would be 2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<i32>,
    /// 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>,
    /** **[PackageMaterial](http://hl7.org/fhir/ValueSet/package-material); Material type of the package item**

 Material type of the package item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "material")]
    pub material: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_material")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub material_ext: Vec<Option<FieldExtension>>,
    /** **[PackageMaterial](http://hl7.org/fhir/ValueSet/package-material); A possible alternate material for this part of the packaging, that is allowed to be used instead of the usual material**

 A possible alternate material for this part of the packaging, that is allowed to be used instead of the usual material (e.g. different types of plastic for a blister sleeve).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alternateMaterial")]
    pub alternate_material: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_alternateMaterial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub alternate_material_ext: Vec<Option<FieldExtension>>,
    /** **Shelf Life and storage information**

 Shelf Life and storage information.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "shelfLifeStorage")]
    pub shelf_life_storage: Vec<Option<ProductShelfLife>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_shelfLifeStorage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub shelf_life_storage_ext: Vec<Option<FieldExtension>>,
    /** **Manufacturer of this packaging item (multiple means these are all potential manufacturers)**

 Manufacturer of this packaging item. When there are multiple values each one is a potential manufacturer of this packaging item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **General characteristics of this item**

 General characteristics of this item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<PackagedProductDefinitionPackagingProperty>>,
    /// 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>>,
    /** **The item(s) within the packaging**

 The item(s) within the packaging.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "containedItem")]
    pub contained_item: Vec<Option<PackagedProductDefinitionPackagingContainedItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_containedItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contained_item_ext: Vec<Option<FieldExtension>>,
    /** **Allows containers (and parts of containers) within containers, still as a part of single packaged product**

 Allows containers (and parts of containers) within containers, still as a part of a single packaged product. See also PackagedProductDefinition.packaging.containedItem.item(PackagedProductDefinition).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packaging")]
    pub packaging: Vec<Option<PackagedProductDefinitionPackaging>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_packaging")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub packaging_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PackagedProductDefinitionPackaging {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PackagedProductDefinitionPackagingBuilder {
        PackagedProductDefinitionPackagingBuilder::default()
    }
}
/// Sub-fields of the property field in PackagedProductDefinitionPackaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PackagedProductDefinitionPackagingPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PackagedProductDefinitionPackagingProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProductCharacteristic](http://hl7.org/fhir/ValueSet/product-characteristic-codes); A code expressing the type of characteristic**

 A code expressing the type of characteristic.

 */
    #[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>,
    /** **A value for the characteristic**

 A value for the characteristic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<PackagedProductDefinitionPackagingPropertyValue>,
    /// 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<PackagedProductDefinitionPackagingPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl PackagedProductDefinitionPackagingProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PackagedProductDefinitionPackagingPropertyBuilder {
        PackagedProductDefinitionPackagingPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in PackagedProductDefinitionPackagingProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PackagedProductDefinitionPackagingPropertyValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for PackagedProductDefinitionPackagingPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PackagedProductDefinitionPackagingPropertyValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/// Sub-fields of the containedItem field in PackagedProductDefinitionPackaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PackagedProductDefinitionPackagingContainedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PackagedProductDefinitionPackagingContainedItem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 actual item(s) of medication, as manufactured, or a device, or other medically related item (food, biologicals, raw materials, medical fluids, gases etc.), as contained in the package**

 The actual item(s) of medication, as manufactured, or a device (typically, but not necessarily, a co-packaged one), or other medically related item (such as food, biologicals, raw materials, medical fluids, gases etc.), as contained in the package. This also allows another whole packaged product to be included, which is solely for the case where a package of other entire packages is wanted - such as a wholesale or distribution pack (for layers within one package, use PackagedProductDefinition.packaging.packaging).

 */
    #[serde(rename = "item")]
    pub item: CodeableReference,
    /// 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>,
    /** **The number of this type of item within this packaging or for continuous items such as liquids it is the quantity (for example 25ml). See also PackagedProductDefinition.containedItemQuantity (especially the long definition)**

 The number of this type of item within this packaging or for continuous items such as liquids it is the quantity (for example 25ml). See also PackagedProductDefinition.containedItemQuantity (especially the long definition).

 */
    #[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 PackagedProductDefinitionPackagingContainedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PackagedProductDefinitionPackagingContainedItemBuilder {
        PackagedProductDefinitionPackagingContainedItemBuilder::default()
    }
}
/** This resource is used to pass information into and back from an operation (whether invoked directly from REST or within a messaging environment).  It is not persisted or allowed to be referenced by other resources except as described in the definition of the Parameters resource.

 **[Parameters](http://hl7.org/fhir/StructureDefinition/Parameters) v5.0.0**

 Operation Request or Response

 This resource is used to pass information into and back from an operation (whether invoked directly from REST or within a messaging environment).  It is not persisted or allowed to be referenced by other resources.

 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>);
/** This resource is used to pass information into and back from an operation (whether invoked directly from REST or within a messaging environment).  It is not persisted or allowed to be referenced by other resources except as described in the definition of the Parameters resource.

 **[Parameters](http://hl7.org/fhir/StructureDefinition/Parameters) v5.0.0**

 Operation Request or Response

 This resource is used to pass information into and back from an operation (whether invoked directly from REST or within a messaging environment).  It is not persisted or allowed to be referenced by other resources.

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Conveys the content 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**

 Conveys the content if the parameter is a whole resource.

 When resolving references in resources, the operation definition may specify how references may be resolved between parameters. If a reference cannot be resolved between the parameters, the application should fall back to its general resource resolution methods. */
    #[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.

 */
    #[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 Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
    /// 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 Integer64 type.
    #[serde(rename = "valueInteger64")]
    Integer64(Integer64),
    /// 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 Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the Uuid type.
    #[serde(rename = "valueUuid")]
    Uuid(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 CodeableReference type.
    #[serde(rename = "valueCodeableReference")]
    CodeableReference(CodeableReference),
    /// 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 RatioRange type.
    #[serde(rename = "valueRatioRange")]
    RatioRange(RatioRange),
    /// 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 ContactDetail type.
    #[serde(rename = "valueContactDetail")]
    ContactDetail(ContactDetail),
    /// Variant accepting the DataRequirement type.
    #[serde(rename = "valueDataRequirement")]
    DataRequirement(DataRequirement),
    /// Variant accepting the Expression type.
    #[serde(rename = "valueExpression")]
    Expression(Expression),
    /// Variant accepting the ParameterDefinition type.
    #[serde(rename = "valueParameterDefinition")]
    ParameterDefinition(ParameterDefinition),
    /// Variant accepting the RelatedArtifact type.
    #[serde(rename = "valueRelatedArtifact")]
    RelatedArtifact(RelatedArtifact),
    /// Variant accepting the TriggerDefinition type.
    #[serde(rename = "valueTriggerDefinition")]
    TriggerDefinition(TriggerDefinition),
    /// Variant accepting the UsageContext type.
    #[serde(rename = "valueUsageContext")]
    UsageContext(UsageContext),
    /// Variant accepting the Availability type.
    #[serde(rename = "valueAvailability")]
    Availability(Availability),
    /// Variant accepting the ExtendedContactDetail type.
    #[serde(rename = "valueExtendedContactDetail")]
    ExtendedContactDetail(ExtendedContactDetail),
    /// Variant accepting the Dosage type.
    #[serde(rename = "valueDosage")]
    Dosage(Dosage),
    /// 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 Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(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 Integer64 extension.
    #[serde(rename = "_valueInteger64")]
    Integer64(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 Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the Uuid extension.
    #[serde(rename = "_valueUuid")]
    Uuid(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 CodeableReference extension.
    #[serde(rename = "_valueCodeableReference")]
    CodeableReference(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 RatioRange extension.
    #[serde(rename = "_valueRatioRange")]
    RatioRange(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 ContactDetail extension.
    #[serde(rename = "_valueContactDetail")]
    ContactDetail(FieldExtension),
    /// Variant accepting the DataRequirement extension.
    #[serde(rename = "_valueDataRequirement")]
    DataRequirement(FieldExtension),
    /// Variant accepting the Expression extension.
    #[serde(rename = "_valueExpression")]
    Expression(FieldExtension),
    /// Variant accepting the ParameterDefinition extension.
    #[serde(rename = "_valueParameterDefinition")]
    ParameterDefinition(FieldExtension),
    /// Variant accepting the RelatedArtifact extension.
    #[serde(rename = "_valueRelatedArtifact")]
    RelatedArtifact(FieldExtension),
    /// Variant accepting the TriggerDefinition extension.
    #[serde(rename = "_valueTriggerDefinition")]
    TriggerDefinition(FieldExtension),
    /// Variant accepting the UsageContext extension.
    #[serde(rename = "_valueUsageContext")]
    UsageContext(FieldExtension),
    /// Variant accepting the Availability extension.
    #[serde(rename = "_valueAvailability")]
    Availability(FieldExtension),
    /// Variant accepting the ExtendedContactDetail extension.
    #[serde(rename = "_valueExtendedContactDetail")]
    ExtendedContactDetail(FieldExtension),
    /// Variant accepting the Dosage extension.
    #[serde(rename = "_valueDosage")]
    Dosage(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/** Demographics and other administrative information about an individual or animal receiving care or other health-related services.

 **[Patient](http://hl7.org/fhir/StructureDefinition/Patient) v5.0.0**

 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>);
/** Demographics and other administrative information about an individual or animal receiving care or other health-related services.

 **[Patient](http://hl7.org/fhir/StructureDefinition/Patient) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.
Many systems use this property to mark as non-current patients, such as those that have not been seen for a period of time based on an organization's business rules.

It is often used to filter patient lists to exclude inactive patients

Deceased patients may also be marked as inactive for the same reasons, but may be active for some time after death.

 If a record is inactive, and linked to an active record, then future patient/record updates should occur on the other patient. */
    #[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. Animal names may be communicated as given names, and optionally may include a family name. */
    #[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 might 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 might 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 male and female, though the vast majority of systems and contexts only support male and female.  Systems providing decision support or enforcing business rules should ideally do this on the basis of Observations dealing with the specific sex or gender aspect of interest (anatomical, chromosomal, 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, chromosomal and other gender aspects.  For example, an alert about a hysterectomy on a male should be handled as a warning or overridable error, not a "hard" error.  See the Patient Gender and Sex section for additional information about communicating patient gender and sex. */
    #[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.

 Partial dates are allowed if the specific date of birth is unknown. There is a standard extension "patient-birthTime" available that should be used where Time is required (such as in maternity/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. */
    #[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>,
    /** **An address for the individual**

 An address 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 (boolean) 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 triplets would be valueInteger=2 and the third born would have valueInteger=3 If a boolean value was provided for this triplets example, then all 3 patient records would have valueBoolean=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.

 Guidelines:
* Use id photos, not clinical photos.
* Limit dimensions to thumbnail.
* Keep byte count low to ease resource updates. */
    #[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>>,
    /** **A language which may be used to communicate with the patient about his or her health**

 A language 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/disability 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.
Multiple GPs may be recorded against the patient for various reasons, such as a student that has his home GP listed along with the GP at university during the school semesters, or a "fly-in/fly-out" worker that has the onsite GP also included with his home GP to remain aware of medical issues.

Jurisdictions may decide that they can profile this down to 1 if desired, or 1 per type. */
    #[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 a Patient or RelatedPerson resource that concerns the same actual individual**

 Link to a Patient or RelatedPerson resource that concerns the same actual individual.

 There is no assumption that linked patient records have mutual links. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/patient-contactrelationship); 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-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-AU" for Australian 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Link to a Patient or RelatedPerson resource that concerns the same actual individual.

 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**

 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()
    }
}
/** This resource provides the status of the payment for goods and services rendered, and the request and response resource references.

 **[PaymentNotice](http://hl7.org/fhir/StructureDefinition/PaymentNotice) v5.0.0**

 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>);
/** This resource provides the status of the payment for goods and services rendered, and the request and response resource references.

 **[PaymentNotice](http://hl7.org/fhir/StructureDefinition/PaymentNotice) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 payment notice**

 A unique identifier assigned to this payment notice.

 */
    #[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(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>,
    /** **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>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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 party who reports the payment notice.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reporter")]
    pub reporter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reporter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporter_ext: Option<FieldExtension>,
    /** **Payment reference**

 A reference to the payment which is the subject of this notice.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payment")]
    pub payment: Option<Reference>,
    /// 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>,
    /** **Payment or clearing date**

 The date when the above payment action occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentDate")]
    pub payment_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_date_ext: Option<FieldExtension>,
    /** **Party being paid**

 The party who will receive or has received payment that is the subject of this notification.

 */
    #[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>,
    /** **Party being notified**

 The party who is notified of the payment status.

 */
    #[serde(rename = "recipient")]
    pub recipient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recipient_ext: Option<FieldExtension>,
    /** **Monetary amount of the payment**

 The amount sent to the payee.

 */
    #[serde(rename = "amount")]
    pub amount: 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>,
    /** **[PaymentStatus](http://hl7.org/fhir/ValueSet/payment-status); Issued or cleared Status of the payment**

 A code indicating whether payment has been sent or cleared.

 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
    }
}
/** This resource provides the details including amount of a payment and allocates the payment items being paid.

 **[PaymentReconciliation](http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) v5.0.0**

 PaymentReconciliation resource

 This resource provides the details including amount of a payment and allocates the payment items being paid.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PaymentReconciliation(pub Box<PaymentReconciliationInner>);
/** This resource provides the details including amount of a payment and allocates the payment items being paid.

 **[PaymentReconciliation](http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) v5.0.0**

 PaymentReconciliation resource

 This resource provides the details including amount of a payment and allocates the payment items being paid.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 a payment reconciliation**

 A unique identifier assigned to this payment reconciliation.

 */
    #[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>>,
    /** **[PaymentType](http://hl7.org/fhir/ValueSet/payment-type); Category of payment**

 Code to indicate the nature of the payment such as payment, adjustment.

 */
    #[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>,
    /** **[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(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>,
    /** **[PaymentKind](http://hl7.org/fhir/ValueSet/payment-kind); Workflow originating payment**

 The workflow or activity which gave rise to or during which the payment ocurred such as a kiosk, deposit on account, periodic payment etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "kind")]
    pub kind: Option<CodeableConcept>,
    /// 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>,
    /** **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 resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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 entered the payment**

 Payment enterer if not the actual payment issuer.

 */
    #[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>,
    /** **[PaymentIssuerType](http://hl7.org/fhir/ValueSet/payment-issuertype); Nature of the source**

 The type of the source such as patient or insurance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issuerType")]
    pub issuer_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issuerType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issuer_type_ext: Option<FieldExtension>,
    /** **Party generating payment**

 The party who generated the payment.

 This party is also responsible for the reconciliation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentIssuer")]
    pub payment_issuer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentIssuer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_issuer_ext: Option<FieldExtension>,
    /** **Reference to requesting resource**

 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>,
    /** **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 = "requestor")]
    pub requestor: Option<Reference>,
    /// 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>,
    /** **[PaymentOutcome](http://hl7.org/fhir/ValueSet/payment-outcome); queued | complete | error | partial**

 The outcome of a request for a reconciliation.

 The resource may be used to indicate that: the request has been held (queued) for processing; that it has been processed and errors found (error); that no errors were found and that some of the adjudication has been undertaken (partial) or that all of the adjudication has been undertaken (complete). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<String>,
    /// 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 human readable description of the status of the request for the reconciliation.

 */
    #[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>,
    /** **When payment issued**

 The date of payment as indicated on the financial instrument.

 */
    #[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>,
    /** **Where payment collected**

 The location of the site or device for electronic transfers or physical location for cash payments.

 */
    #[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>,
    /** **[PaymentMethod](http://terminology.hl7.org/ValueSet/v2-0570); Payment instrument**

 The means of payment such as check, card cash, or electronic funds transfer.

 */
    #[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 card**

 The card brand such as debit, Visa, Amex etc. used if a card is the method of payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cardBrand")]
    pub card_brand: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cardBrand")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub card_brand_ext: Option<FieldExtension>,
    /** **Digits for verification**

 A portion of the account number, often the last 4 digits, used for verification not charging purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accountNumber")]
    pub account_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accountNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub account_number_ext: Option<FieldExtension>,
    /** **Expiration year-month**

 The year and month (YYYY-MM) when the instrument, typically card, 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>,
    /** **Processor name**

 The name of the card processor, etf processor, bank for checks.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processor")]
    pub processor: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_processor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub processor_ext: Option<FieldExtension>,
    /** **Check number or payment reference**

 The check number, eft reference, car processor reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceNumber")]
    pub reference_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_number_ext: Option<FieldExtension>,
    /** **Authorization number**

 An alphanumeric issued by the processor to confirm the successful issuance of payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorization")]
    pub authorization: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authorization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authorization_ext: Option<FieldExtension>,
    /** **Amount offered by the issuer**

 The amount offered by the issuer, typically applies to cash when the issuer provides an amount in bank note denominations equal to or excess of the amount actually being paid.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tenderedAmount")]
    pub tendered_amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tenderedAmount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tendered_amount_ext: Option<FieldExtension>,
    /** **Amount returned by the receiver**

 The amount returned by the receiver which is excess to the amount payable, often referred to as 'change'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "returnedAmount")]
    pub returned_amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_returnedAmount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub returned_amount_ext: Option<FieldExtension>,
    /** **Total amount of Payment**

 Total payment amount as indicated on the financial instrument.

 */
    #[serde(rename = "amount")]
    pub amount: 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>,
    /** **Business identifier for the payment**

 Issuer's unique identifier for the payment instrument.

 For example: EFT number or check number. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentIdentifier")]
    pub payment_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_identifier_ext: Option<FieldExtension>,
    /** **Settlement particulars**

 Distribution of the payment amount for a previously acknowledged payable.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allocation")]
    pub allocation: Vec<Option<PaymentReconciliationAllocation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_allocation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub allocation_ext: Vec<Option<FieldExtension>>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed form identifier**

 A code for the form to be used for printing the content.

 May be needed to identify specific jurisdictional forms. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "formCode")]
    pub form_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_formCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_code_ext: Option<FieldExtension>,
    /** **Note concerning processing**

 A note that describes or explains the processing in a human readable form.

 */
    #[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 allocation 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 = "PaymentReconciliationAllocationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PaymentReconciliationAllocation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the payment detail**

 Unique identifier for the current payment item for the referenced payable.

 */
    #[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 identifier of the prior payment detail**

 Unique identifier for the prior payment item for the referenced payable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "predecessor")]
    pub predecessor: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_predecessor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub predecessor_ext: Option<FieldExtension>,
    /** **Subject of the payment**

 Specific resource to which the payment/adjustment/advance applies.

 */
    #[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>,
    /** **Sub-element of the subject**

  Identifies the claim line item, encounter or other sub-element being paid. Note payment may be partial, that is not match the then outstanding balance or amount incurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub target_item: Option<PaymentReconciliationAllocationTargetItem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_item_ext: Option<PaymentReconciliationAllocationTargetItemExtension>,
    /** **Applied-to encounter**

 The Encounter to which this payment applies, may be completed by the receiver, used for search.

 */
    #[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>,
    /** **Applied-to account**

 The Account to which this payment applies, may be completed by the receiver, used for search.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "account")]
    pub account: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub account_ext: Option<FieldExtension>,
    /** **[PaymentType](http://hl7.org/fhir/ValueSet/payment-type); Category of payment**

 Code to indicate the nature of the payment.

 For example: payment, adjustment, funds advance, 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>,
    /** **Submitter of the request**

 The party 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>,
    /** **Response committing to a payment**

 A resource, such as a ClaimResponse, which contains a commitment to payment.

 */
    #[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>,
    /** **Date of commitment to pay**

 The date from the response resource containing a commitment to pay.

 */
    #[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>,
    /** **Contact for the response**

 A reference to the individual who is responsible for inquiries regarding the response and its payment.

 */
    #[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>,
    /** **Recipient of the payment**

 The party 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>,
    /** **Amount allocated to this payable**

 The monetary amount allocated from the total payment to the payable.

 */
    #[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 PaymentReconciliationAllocation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PaymentReconciliationAllocationBuilder {
        PaymentReconciliationAllocationBuilder::default()
    }
}
/// Choice of types for the targetItem[x] field in PaymentReconciliationAllocation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PaymentReconciliationAllocationTargetItem {
    /// Variant accepting the String type.
    #[serde(rename = "targetItemString")]
    String(String),
    /// Variant accepting the Identifier type.
    #[serde(rename = "targetItemIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the PositiveInt type.
    #[serde(rename = "targetItemPositiveInt")]
    PositiveInt(NonZeroU32),
}
/// Extension value for PaymentReconciliationAllocationTargetItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PaymentReconciliationAllocationTargetItemExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_targetItemString")]
    String(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_targetItemIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the PositiveInt extension.
    #[serde(rename = "_targetItemPositiveInt")]
    PositiveInt(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 business purpose of the note text.

 */
    #[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::NoteType>,
    /// 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 explanation or description associated with the processing.

 */
    #[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()
    }
}
/** Permission resource holds access rules for a given data and context.

 **[Permission](http://hl7.org/fhir/StructureDefinition/Permission) v5.0.0**

 Access Rules

 Permission resource holds access rules for a given data and context.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Permission(pub Box<PermissionInner>);
/** Permission resource holds access rules for a given data and context.

 **[Permission](http://hl7.org/fhir/StructureDefinition/Permission) v5.0.0**

 Access Rules

 Permission resource holds access rules for a given data and 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 = "PermissionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PermissionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Permission::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Permission", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PermissionStatus](http://hl7.org/fhir/ValueSet/permission-status); active | entered-in-error | draft | rejected**

 Status.

 */
    #[serde(rename = "status")]
    pub status: codes::PermissionStatus,
    /// 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 or entity that asserts the permission**

 The person or entity that asserts the permission.

 */
    #[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>,
    /** **The date that permission was asserted**

 The date that permission was asserted.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Vec<Option<DateTime>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub date_ext: Vec<Option<FieldExtension>>,
    /** **The period in which the permission is active**

 The period in which the permission is active.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validity")]
    pub validity: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validity_ext: Option<FieldExtension>,
    /** **The asserted justification for using the data**

 The asserted justification for using the data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "justification")]
    pub justification: Option<PermissionJustification>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_justification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub justification_ext: Option<FieldExtension>,
    /** **[PermissionCombining](http://hl7.org/fhir/ValueSet/permission-rule-combining); deny-overrides | permit-overrides | ordered-deny-overrides | ordered-permit-overrides | deny-unless-permit | permit-unless-deny**

 Defines a procedure for arriving at an access decision given the set of rules.

 see [XACML Combining Rules](http://docs.oasis-open.org/xacml/3.0/xacml-3.0-core-spec-cos01-en.html#_Toc325047267) */
    #[serde(rename = "combining")]
    pub combining: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_combining")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub combining_ext: Option<FieldExtension>,
    /** **Constraints to the Permission**

 A set of rules.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Vec<Option<PermissionRule>>,
    /// 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 PermissionBuilder {
    #[doc = concat!("Finalize building ", "Permission", ".")]
    pub fn build(self) -> Result<Permission, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PermissionInner> for Permission {
    fn from(inner: PermissionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Permission {
    type Target = PermissionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Permission {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Permission {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PermissionBuilder {
        PermissionBuilder::default()
    }
}
impl Permission {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Permission
    }
}
/// Sub-fields of the justification field in Permission
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PermissionJustificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PermissionJustification {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentRegulatoryBasis](http://hl7.org/fhir/ValueSet/consent-policy); The regulatory grounds upon which this Permission builds**

 This would be a codeableconcept, or a coding, which can be constrained to , for example, the 6 grounds for processing in GDPR.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **Justifing rational**

 Justifing rational.

 While any resource may be used, DocumentReference, Consent, PlanDefinition, and Contract would be most frequent */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evidence")]
    pub evidence: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl PermissionJustification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PermissionJustificationBuilder {
        PermissionJustificationBuilder::default()
    }
}
/// Sub-fields of the rule field in Permission
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PermissionRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PermissionRule {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PermissionProvisionType](http://hl7.org/fhir/ValueSet/consent-provision-type); deny | permit**

 deny | permit.

 */
    #[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::ConsentProvisionType>,
    /// 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 selection criteria to identify data that is within scope of this provision**

 A description or definition of which activities are allowed to be done on the data.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "data")]
    pub data: Vec<Option<PermissionRuleData>>,
    /// 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>>,
    /** **A description or definition of which activities are allowed to be done on the data**

 A description or definition of which activities are allowed to be done on the data.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "activity")]
    pub activity: Vec<Option<PermissionRuleActivity>>,
    /// 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>>,
    /** **[PermissionUsageLimits](http://hl7.org/fhir/ValueSet/security-label-event-examples); What limits apply to the use of the data**

 What limits apply to the use of the data.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "limit")]
    pub limit: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_limit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub limit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PermissionRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PermissionRuleBuilder {
        PermissionRuleBuilder::default()
    }
}
/// Sub-fields of the data field in PermissionRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PermissionRuleDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PermissionRuleData {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Explicit FHIR Resource references**

 Explicit FHIR Resource references.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Vec<Option<PermissionRuleDataResource>>,
    /// 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>>,
    /** **Security tag code on .meta.security**

 The data in scope are those with the given codes present in that data .meta.security element.

 Note the ConfidentialityCode vocabulary indicates the highest value, thus 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. When the purpose of use tag is on the data, access request purpose of use shall not conflict. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "security")]
    pub security: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_security")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_ext: Vec<Option<FieldExtension>>,
    /** **Timeframe encompasing data create/update**

 Clinical or Operational Relevant period of time that bounds the data controlled by this rule.

 This has a different sense to the .validity. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub period_ext: Vec<Option<FieldExtension>>,
    /** **Expression identifying the data**

 Used when other data selection elements are insufficient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<Expression>,
    /// 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 PermissionRuleData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PermissionRuleDataBuilder {
        PermissionRuleDataBuilder::default()
    }
}
/// Sub-fields of the resource field in PermissionRuleData
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PermissionRuleDataResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PermissionRuleDataResource {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 PermissionRuleDataResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PermissionRuleDataResourceBuilder {
        PermissionRuleDataResourceBuilder::default()
    }
}
/// Sub-fields of the activity field in PermissionRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PermissionRuleActivityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PermissionRuleActivity {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Authorized actor(s)**

 The actor(s) authorized for the defined activity.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[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>>,
    /** **[ProcessingActivityAction](http://hl7.org/fhir/ValueSet/consent-action); Actions controlled by this rule**

 Actions controlled by this Rule.

 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>>,
    /** **[PurposeOfUse](http://terminology.hl7.org/ValueSet/v3-PurposeOfUse); The purpose for which the permission is given**

 The purpose for which the permission is given.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Vec<Option<CodeableConcept>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl PermissionRuleActivity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PermissionRuleActivityBuilder {
        PermissionRuleActivityBuilder::default()
    }
}
/** Demographics and administrative information about a person independent of a specific health-related context.

 **[Person](http://hl7.org/fhir/StructureDefinition/Person) v5.0.0**

 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>);
/** Demographics and administrative information about a person independent of a specific health-related context.

 **[Person](http://hl7.org/fhir/StructureDefinition/Person) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **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>,
    /** **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 might 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 a clear 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>,
    /** **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. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub deceased: Option<PersonDeceased>,
    /// 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<PersonDeceasedExtension>,
    /** **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>>,
    /** **[MaritalStatus](http://hl7.org/fhir/ValueSet/marital-status); Marital (civil) status of a person**

 This field contains a person's most recent marital (civil) status.

 Many countries maintain a register of births, deaths and marriages, and this would simplify that interaction */
    #[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>,
    /** **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 = "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 language which may be used to communicate with the person about his or her health**

 A language which may be used to communicate with the person 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 Person.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.

Note that this property should not be used to update any linked/logically linked practitioner resources as it serves as a language that can be used to communicate with patients - however it may be used to inform the value on practitioner, along with their role at the organization (with the practitioner's permission) */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communication")]
    pub communication: Vec<Option<PersonCommunication>>,
    /// 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>>,
    /** **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>,
    /** **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
    }
}
/// Choice of types for the deceased[x] field in Person
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PersonDeceased {
    /// Variant accepting the Boolean type.
    #[serde(rename = "deceasedBoolean")]
    Boolean(bool),
    /// Variant accepting the DateTime type.
    #[serde(rename = "deceasedDateTime")]
    DateTime(DateTime),
}
/// Extension value for PersonDeceased.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PersonDeceasedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_deceasedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_deceasedDateTime")]
    DateTime(FieldExtension),
}
/// Sub-fields of the communication 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 = "PersonCommunicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PersonCommunication {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-languages); The language which can be used to communicate with the person 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-AU" for Australian 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 person 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 PersonCommunication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PersonCommunicationBuilder {
        PersonCommunicationBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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()
    }
}
/** 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 and non-clinical artifacts such as clinical decision support rules, order sets, protocols, and drug quality specifications.

 **[PlanDefinition](http://hl7.org/fhir/StructureDefinition/PlanDefinition) v5.0.0**

 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 and non-clinical artifacts such as clinical decision support rules, order sets, protocols, and drug quality specifications.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PlanDefinition(pub Box<PlanDefinitionInner>);
/** 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 and non-clinical artifacts such as clinical decision support rules, order sets, protocols, and drug quality specifications.

 **[PlanDefinition](http://hl7.org/fhir/StructureDefinition/PlanDefinition) v5.0.0**

 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 and non-clinical artifacts such as clinical decision support rules, order sets, protocols, and drug quality specifications.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this plan definition, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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 reference to a particular business version of the plan definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<PlanDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<PlanDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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>,
    /** **Subordinate title of the plan definition**

 An explanatory or alternate title for the plan definition giving additional information about its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtitle")]
    pub subtitle: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtitle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtitle_ext: Option<FieldExtension>,
    /** **[PlanDefinitionType](http://hl7.org/fhir/ValueSet/plan-definition-type); order-set | clinical-protocol | eca-rule | workflow-definition**

 A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.

 */
    #[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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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>,
    /** **Type of individual the plan definition is focused on**

 A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.

 Note that the choice of canonical for the subject element was introduced in R4B to support pharmaceutical quality use cases. To ensure as much backwards-compatibility as possible, it is recommended to only use the new canonical type with these use cases. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<PlanDefinitionSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<PlanDefinitionSubjectExtension>,
    /** **Date last changed**

 The date  (and optionally time) when the plan definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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>,
    /** **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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 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 plan definition is presumed to be the predominant language in the place the plan definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 plan definition is defined**

 Explanation 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 plan**

 A detailed description of how the plan definition 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>,
    /** **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.

 The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element. */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 plan definition intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment**

 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.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the content**

 An individiual or organization primarily involved in the creation and maintenance of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the content**

 An individual or organization primarily responsible for internal coherence of the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the content**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the content**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation, citations**

 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<String>>,
    /// 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**

 A goal describes an expected outcome that 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, meeting the acceptance criteria for a test as specified by a quality specification, 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>>,
    /** **Actors within the plan**

 Actors represent the individuals or groups involved in the execution of the defined set of activities.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Vec<Option<PlanDefinitionActor>>,
    /// 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>>,
    /** **Action defined by the plan**

 An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification.

 Note that there is overlap between many of the elements defined here and the ActivityDefinition resource. When an ActivityDefinition is referenced (using the definition element), the overlapping elements in the plan override the content of the referenced ActivityDefinition unless otherwise documented in the specific elements. See the PlanDefinition resource for more detailed information. */
    #[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>>,
    /** **Preconditions for service**

 If a CodeableConcept is present, it indicates the pre-condition for performing the service.  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<PlanDefinitionAsNeeded>,
    /// 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<PlanDefinitionAsNeededExtension>,
}
#[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
    }
}
/// Choice of types for the versionAlgorithm[x] field in PlanDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for PlanDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in PlanDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
    /// Variant accepting the Canonical type.
    #[serde(rename = "subjectCanonical")]
    Canonical(String),
}
/// Extension value for PlanDefinitionSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_subjectCanonical")]
    Canonical(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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 measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. 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 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.

 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 goal.target.measure defines a coded 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),
    /// Variant accepting the String type.
    #[serde(rename = "detailString")]
    String(String),
    /// Variant accepting the Boolean type.
    #[serde(rename = "detailBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "detailInteger")]
    Integer(i32),
    /// Variant accepting the Ratio type.
    #[serde(rename = "detailRatio")]
    Ratio(Ratio),
}
/// 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),
    /// Variant accepting the String extension.
    #[serde(rename = "_detailString")]
    String(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_detailBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_detailInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_detailRatio")]
    Ratio(FieldExtension),
}
/// Sub-fields of the actor 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 = "PlanDefinitionActorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActor {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 title**

 A descriptive label for the actor.

 */
    #[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>,
    /** **Describes the actor**

 A description of how the actor fits into the overall actions of the plan 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>,
    /** **Who or what can be this actor**

 The characteristics of the candidates that could serve as the actor.

 */
    #[serde(rename = "option")]
    pub option: Vec<Option<PlanDefinitionActorOption>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActorBuilder {
        PlanDefinitionActorBuilder::default()
    }
}
/// Sub-fields of the option field in PlanDefinitionActor
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActorOptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActorOption {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson**

 The type of participant in the action.

 */
    #[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::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>,
    /** **Who or what can participate**

 The type of participant in the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeCanonical")]
    pub type_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_canonical_ext: Option<FieldExtension>,
    /** **Who or what can participate**

 The type of participant in the action.

 When this element is a reference, it SHOULD be a reference to a definitional resource (for example, a location type, rather than a specific location). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeReference")]
    pub type_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_reference_ext: Option<FieldExtension>,
    /** **[ActionParticipantRole](http://terminology.hl7.org/ValueSet/action-participant-role); E.g. Nurse, Surgeon, Parent**

 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 PlanDefinitionActorOption {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActorOptionBuilder {
        PlanDefinitionActorOptionBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 action in the PlanDefinition**

 An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **User-visible prefix for the action (e.g. 1. or A.)**

 A user-visible prefix for the action. For example a section or item numbering such as 1. or A.

 */
    #[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>,
    /** **User-visible title**

 The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.

 */
    #[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>,
    /** **Brief description of the action**

 A brief 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 might 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>,
    /** **[RequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the action should be addressed with respect to other actions.

 */
    #[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>,
    /** **[ActionCode](http://hl7.org/fhir/ValueSet/action-code); Code representing the meaning of the action or sub-actions**

 A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.

 */
    #[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>,
    /** **[ActionReasonCode](http://hl7.org/fhir/ValueSet/action-reason-code); 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. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.

 */
    #[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>>,
    /** **Type of individual the action is focused on**

 A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.

 The subject of an action overrides the subject at a parent action or on the root of the PlanDefinition if specified.

In addition, because the subject needs to be resolved during realization, use of subjects in actions (or in the ActivityDefinition referenced by the action) resolves based on the set of subjects supplied in context and by type (i.e. the patient subject would resolve to a resource of type Patient). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<PlanDefinitionActionSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<PlanDefinitionActionSubjectExtension>,
    /** **When the action should be triggered**

 A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action.

 */
    #[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>>,
    /** **Whether or not the action is applicable**

 An expression that describes applicability criteria or start/stop conditions for the action.

 When multiple conditions of the same kind are present, the effects are combined using AND semantics, so the overall condition is true only if all the conditions are true. */
    #[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<PlanDefinitionActionInput>>,
    /// 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<PlanDefinitionActionOutput>>,
    /// 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.

 The intent of the timing element is to provide timing when the action should be performed. As a definitional resource, this timing is interpreted as part of an apply operation so that the timing of the result actions in a CarePlan or RequestOrchestration, for example, would be specified by evaluating the timing definition in the context of the apply and setting the resulting timing on the appropriate elements of the target resource. If the timing is an Age, the activity is expected to be performed when the subject is the given Age. When the timing is a Duration, the activity is expected to be performed within the specified duration from the apply. When the timing is a Range, it may be a range of Ages or Durations, providing a range for the expected timing of the resulting activity. When the timing is a Timing, it is establishing a schedule for the timing of the resulting activity. */
    #[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>,
    /** **Where it should happen**

 Identifies the facility where the action 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<CodeableReference>,
    /// 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<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<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>,
    /** **[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 required 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, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.

 Note that the definition is optional, and if no definition is specified, a dynamicValue with a root ($this) 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(flatten)]
    pub definition: Option<PlanDefinitionActionDefinition>,
    /// 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<PlanDefinitionActionDefinitionExtension>,
    /** **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.

 Note that when a referenced ActivityDefinition also defines a transform, the transform specified here generally takes precedence. In addition, if both a transform and dynamic values are specific, the dynamic values are applied to the result of the transform. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<String>,
    /// 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.

 Dynamic values are applied in the order in which they are defined in the PlanDefinition resource. Note that when dynamic values are also specified by a referenced ActivityDefinition, the dynamicValues from the ActivityDefinition are applied first, followed by the dynamicValues specified here. In addition, if both a transform and dynamic values are specific, the dynamic values are applied to the result of the transform. */
    #[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()
    }
}
/// Choice of types for the subject[x] field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
    /// Variant accepting the Canonical type.
    #[serde(rename = "subjectCanonical")]
    Canonical(String),
}
/// Extension value for PlanDefinitionActionSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_subjectCanonical")]
    Canonical(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **Boolean-valued expression**

 An expression that returns true or false, indicating whether 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<Expression>,
    /// 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 input 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 = "PlanDefinitionActionInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionInput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 title**

 A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.

 */
    #[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>,
    /** **What data is provided**

 Defines the data that is to be provided as input to the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<DataRequirement>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **What data is provided**

 Points to an existing input or output element that provides data to this input.

 The relatedData element allows indicating that an input to a parent action is an input to specific child actions. It also allows the output of one action to be identified as the input to a different action */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedData")]
    pub related_data: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedData")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_data_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionInputBuilder {
        PlanDefinitionActionInputBuilder::default()
    }
}
/// Sub-fields of the output 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 = "PlanDefinitionActionOutputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionOutput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 title**

 A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.

 */
    #[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>,
    /** **What data is provided**

 Defines the data that results as output from the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<DataRequirement>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **What data is provided**

 Points to an existing input or output element that is results as output from the action.

 The relatedData element allows indicating that the output of child action is also the output of a parent action. It also allows the input of one action to be identified as the output of a different action */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedData")]
    pub related_data: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedData")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_data_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionOutput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionOutputBuilder {
        PlanDefinitionActionOutputBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 target related action.

 */
    #[serde(rename = "targetId")]
    pub target_id: 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>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end**

 The relationship of the start 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>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end**

 The relationship of the end of this action to the related action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endRelationship")]
    pub end_relationship: Option<codes::ActionRelationshipType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endRelationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_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 Age type.
    #[serde(rename = "timingAge")]
    Age(Age),
    /// 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 Age extension.
    #[serde(rename = "_timingAge")]
    Age(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 actor**

 A reference to the id element of the actor who will participate in this action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actorId")]
    pub actor_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actorId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_id_ext: Option<FieldExtension>,
    /** **[ActivityParticipantType](http://hl7.org/fhir/ValueSet/action-participant-type); careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson**

 The type of participant in the action.

 */
    #[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::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>,
    /** **Who or what can participate**

 The type of participant in the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeCanonical")]
    pub type_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_canonical_ext: Option<FieldExtension>,
    /** **Who or what can participate**

 The type of participant in the action.

 When this element is a reference, it SHOULD be a reference to a definitional resource (for example, a location type, rather than a specific location). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeReference")]
    pub type_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_reference_ext: Option<FieldExtension>,
    /** **[ActionParticipantRole](http://terminology.hl7.org/ValueSet/action-participant-role); E.g. Nurse, Surgeon, Parent**

 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>,
    /** **[ActionParticipantFunction](http://hl7.org/fhir/ValueSet/action-participant-function); E.g. Author, Reviewer, Witness, etc**

 Indicates how the actor will be involved in the action - author, reviewer, witness, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionParticipantBuilder {
        PlanDefinitionActionParticipantBuilder::default()
    }
}
/// Choice of types for the definition[x] field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionDefinition {
    /// Variant accepting the Canonical type.
    #[serde(rename = "definitionCanonical")]
    Canonical(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "definitionUri")]
    Uri(String),
}
/// Extension value for PlanDefinitionActionDefinition.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionDefinitionExtension {
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_definitionCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_definitionUri")]
    Uri(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).

 To specify the path to the current action being realized, the %action environment variable is available in this path. For example, to specify the description element of the target action, the path would be %action.description. The path attribute contains a [Simple FHIRPath Subset](fhirpath.html#simple) that allows path traversal, but not calculation. */
    #[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>,
    /** **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<Expression>,
    /// 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()
    }
}
/// Choice of types for the asNeeded[x] field in PlanDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionAsNeeded {
    /// Variant accepting the Boolean type.
    #[serde(rename = "asNeededBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "asNeededCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for PlanDefinitionAsNeeded.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionAsNeededExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_asNeededBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_asNeededCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/** A person who is directly or indirectly involved in the provisioning of healthcare or related services.

 **[Practitioner](http://hl7.org/fhir/StructureDefinition/Practitioner) v5.0.0**

 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 or related services.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Practitioner(pub Box<PractitionerInner>);
/** A person who is directly or indirectly involved in the provisioning of healthcare or related services.

 **[Practitioner](http://hl7.org/fhir/StructureDefinition/Practitioner) v5.0.0**

 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 or 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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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.

 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 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>>,
    /** **[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>,
    /** **Indicates if the practitioner is deceased or not**

 Indicates if the practitioner is deceased or not.

 If there's no value in the instance, it means there is no statement on whether or not the practitioner is deceased. Most systems will interpret the absence of a value as a sign of the person being alive. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub deceased: Option<PractitionerDeceased>,
    /// 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<PractitionerDeceasedExtension>,
    /** **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>>,
    /** **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, certifications, accreditations, licenses, training, etc. pertaining to the provision of care**

 The official qualifications, certifications, accreditations, training, licenses (and other types of educations/skills/capabilities) that authorize or otherwise pertain to the provision of care by the practitioner.

For example, a medical license issued by a medical board of licensure authorizing the practitioner to practice medicine within a certain locality.

 The PractitionerRole.specialty defines the functional role that they are practicing at a given organization or location.  Those specialties may or might not require a qualification, and are not defined on the practitioner. */
    #[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>>,
    /** **A language which may be used to communicate with the practitioner**

 A language which may be used to communicate with the practitioner, often for correspondence/administrative purposes.

The `PractitionerRole.communication` property should be used for publishing the languages that a practitioner is able to communicate with patients (on a per Organization/Role basis).

 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 Practitioner.Communication associations.

For animals, language is not a relevant field, and should be absent from the instance. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communication")]
    pub communication: Vec<Option<PractitionerCommunication>>,
    /// 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
    }
}
/// Choice of types for the deceased[x] field in Practitioner
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PractitionerDeceased {
    /// Variant accepting the Boolean type.
    #[serde(rename = "deceasedBoolean")]
    Boolean(bool),
    /// Variant accepting the DateTime type.
    #[serde(rename = "deceasedDateTime")]
    DateTime(DateTime),
}
/// Extension value for PractitionerDeceased.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PractitionerDeceasedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_deceasedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_deceasedDateTime")]
    DateTime(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 */
    #[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://terminology.hl7.org/ValueSet/v2-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()
    }
}
/// Sub-fields of the communication 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 = "PractitionerCommunicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PractitionerCommunication {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-languages); The language code used to communicate with the practitioner**

 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-AU" for Australian 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 person prefers this language (over other languages he masters up a certain level).

 This language is specifically identified for communicating directly with the practitioner (typically un-related to patient communications). */
    #[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 PractitionerCommunication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PractitionerCommunicationBuilder {
        PractitionerCommunicationBuilder::default()
    }
}
/** A specific set of Roles/Locations/specialties/services that a practitioner may perform, or has performed at an organization during a period of time.

 **[PractitionerRole](http://hl7.org/fhir/StructureDefinition/PractitionerRole) v5.0.0**

 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>);
/** A specific set of Roles/Locations/specialties/services that a practitioner may perform, or has performed at an organization during a period of time.

 **[PractitionerRole](http://hl7.org/fhir/StructureDefinition/PractitionerRole) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 for a role/location**

 Business Identifiers that are specific to a role/location.

 A specific identifier value (e.g. Minnesota Registration ID) may appear on multiple PractitionerRole instances which could be for different periods, or different Roles (or other reasons).  A specific identifier may be included multiple times in the same PractitionerRole instance with different identifier validity periods. */
    #[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 role record is in active use**

  Whether this practitioner role record is in active use. Some systems may use this property to mark non-active practitioners, such as those that are not currently employed.

 If this value is false, you may refer to the period to see when the role was in active use. If there is no period specified, no inference can be made about when it was 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>,
    /** **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.

 If a practitioner is performing a role within an organization over multiple, non-adjacent periods, there should be a distinct PractitionerRole instance for each period.  For example, if a nurse is employed at a hospital, leaves the organization for a period of time due to pandemic related stress, but returns post-pandemic to the same job role, there would be two PractitionerRole instances for the different periods of employment. */
    #[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 provides services for the organization**

 Practitioner that is able to provide the defined services for the organization.

 */
    #[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. */
    #[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**

 The specialty of a practitioner that describes the functional role they are practicing at a given organization or location.

 The specialty represents the functional role a practitioner is playing within an organization/location. This role may require the individual have certain qualifications, which would be represented in the Practitioner.qualifications property.  Note that qualifications may or might not relate to or be required by the practicing specialty. */
    #[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 the 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>>,
    /** **Healthcare services provided 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>>,
    /** **Official contact details relating to this PractitionerRole**

 The contact details of communication devices available relevant to the specific PractitionerRole. This can include addresses, 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 = "contact")]
    pub contact: Vec<Option<ExtendedContactDetail>>,
    /// 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>>,
    /** **[ServiceCharacteristic](http://hl7.org/fhir/ValueSet/service-mode); Collection of characteristics (attributes)**

 Collection of characteristics (attributes).

 These could be such things as is the service mode used by this role. */
    #[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>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/all-languages); A language the practitioner (in this role) can use in patient communication**

 A language the practitioner can use in patient communication. The practitioner may know several languages (listed in practitioner.communication), however these are the languages that could be advertised in a directory for a patient to search.

 The structure aa-BB with this exact casing is one the most widely used notations for locale. However not all systems code this but instead have it as free text. Hence CodeableConcept instead of code as the data type.

Note that for non-patient oriented communication, see Practitioner.communication.  Note that all 'person' type resources (Person, RelatedPerson, Patient, Practitioner) have a communication structure that includes preferences.  Role or service oriented resources such as HealthcareService and PractitionerRole only include languages that are available for interacting with patients. */
    #[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>>,
    /** **Times the Practitioner is available at this location and/or healthcare service (including exceptions)**

 A collection of times the practitioner is available or performing this role at the location and/or healthcareservice.

 More detailed availability information may be provided in associated Schedule/Slot resources.

Systems may choose to render availability differently than it is exchanged on the interface. For example, rather than "Mon, Tue, Wed, Thur, Fri from 9am-12am; Mon, Tue, Wed, Thur, Fri from 1pm-5pm" as would be implied by two availableTime repetitions, an application could render this information as "Mon-Fri 9-12am and 1-5pm".

The NotAvailableTime(s) included indicate the general days/periods where the practitioner is not available (for things such as vacation time, or public holidays). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availability")]
    pub availability: Vec<Option<Availability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_availability")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub availability_ext: Vec<Option<FieldExtension>>,
    /** **Endpoints for interacting with the practitioner in this role**

  Technical endpoints providing access to services operated for the practitioner with this role. Commonly used for locating scheduling services, or identifying where to send referrals electronically.

 */
    #[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
    }
}
/** An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.  This can be a quality or safety inspection for a location, organization, or device.  This can be an accreditation procedure on a practitioner for licensing.

 **[Procedure](http://hl7.org/fhir/StructureDefinition/Procedure) v5.0.0**

 An action that is being or was performed on an individual or entity

 An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.  This can be a quality or safety inspection for a location, organization, or device.  This can be an accreditation procedure on a practitioner for licensing.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Procedure(pub Box<ProcedureInner>);
/** An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.  This can be a quality or safety inspection for a location, organization, or device.  This can be an accreditation procedure on a practitioner for licensing.

 **[Procedure](http://hl7.org/fhir/StructureDefinition/Procedure) v5.0.0**

 An action that is being or was performed on an individual or entity

 An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.  This can be a quality or safety inspection for a location, organization, or device.  This can be an accreditation procedure on a practitioner for licensing.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 Business identifiers assigned to this procedure by the performer or other systems which remain constant as the resource is updated and is propagated from server to server.

 This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and Person resource instances might share the same social insurance 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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, order set or other definition that is 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 = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, order set or other definition that is adhered to in whole or in part by this Procedure.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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 resource has a partOf reference to Procedure, but this is not a circular reference.   For example, the anesthesia MedicationAdministration is part of the surgical Procedure (MedicationAdministration.partOf = Procedure).  For example, the procedure to insert the IV port for an IV medication administration is part of the medication administration (Procedure.partOf = MedicationAdministration). */
    #[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 | not-done | on-hold | stopped | completed | entered-in-error | unknown**

 A code specifying the state of the procedure. Generally, this will be the 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>,
    /** **[ProcedureNegationReason](http://hl7.org/fhir/ValueSet/procedure-not-performed-reason); Reason for current status**

 Captures the reason for the current state of the procedure.

 This is generally only used for "exception" statuses such as "not-done", "suspended" or "aborted". The reason for performing the event at all is captured in reasonCode, not here. */
    #[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>,
    /** **[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 = "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>>,
    /** **[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>,
    /** **Individual or entity the procedure was performed on**

 On whom or on what the procedure was performed. This is usually an individual human, but can also be performed on animals, groups of humans or animals, organizations or practitioners (for licensing), locations or devices (for safety inspections or regulatory authorizations).  If the actual focus of the procedure is different from the subject, the focus element specifies the actual focus of the procedure.

 */
    #[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>,
    /** **Who is the target of the procedure when it is not the subject of record only**

 Who is the target of the procedure when it is not the subject of record only.  If focus is not present, then subject is the focus.  If focus is present and the subject is one of the targets of the procedure, include subject as a focus as well. If focus is present and the subject is not included in focus, it implies that the procedure was only targeted on the focus. For example, when a caregiver is given education for a patient, the caregiver would be the focus and the procedure record is associated with the subject (e.g. patient).  For example, use focus when recording the target of the education, training, or counseling is the parent or relative of a patient.

 */
    #[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>,
    /** **The Encounter during which this Procedure was created**

 The Encounter during which this Procedure was created or performed or to which the creation of this record is tightly associated.

 This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. */
    #[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 procedure occurred or is occurring**

 Estimated or actual date, date-time, period, or age when the procedure did occur or is occurring.  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.

 This indicates when the procedure actually occurred or is occurring, not when it was asked/requested/ordered to occur. For the latter, look at the occurence element of the Request this Procedure is "basedOn". The status code allows differentiation of whether the timing reflects a historic event or an ongoing event. Ongoing events should not include an upper bound in the Period or Timing.bounds.

Age is generally used when the patient reports an age at which the procedure was performed. Range is generally used when the patient reports an age range when the procedure was performed, such as sometime between 20-25 years old.  dateTime supports a range of precision due to some procedures being reported as past procedures that might not have millisecond precision while other procedures performed and documented during the encounter might have more precise UTC timestamps with timezone. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ProcedureOccurrence>,
    /// 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<ProcedureOccurrenceExtension>,
    /** **When the procedure was first captured in the subject's record**

 The date the occurrence of the procedure was first captured in the record regardless of Procedure.status (potentially after the occurrence of the event).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorded")]
    pub recorded: Option<DateTime>,
    /// 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>,
    /** **Who recorded the procedure**

 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>,
    /** **Reported rather than primary record**

 Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record.  It may also indicate the source of the report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reported: Option<ProcedureReported>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reported_ext: Option<ProcedureReportedExtension>,
    /** **Who performed the procedure and what they did**

 Indicates who or what performed the procedure and how they were involved.

 */
    #[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); The justification that the procedure was performed**

 The coded reason or reference why the procedure was performed. This may be a coded entity of some type, be present as text, or be a reference to one of several resources that justify the procedure.

 Use Procedure.reason.concept when a code sufficiently describes the reason. Use Procedure.reason.reference when referencing a resource, which allows more information to be conveyed, such as onset date.  For a single Procedure.reason, if both Procedure.reason.concept and Procedure.reason.reference are present, they are expected to be consistent with each other. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[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.

 If the use case requires attributes from the BodySite resource (e.g. to identify and track separately) then use the standard extension [http://hl7.org/fhir/StructureDefinition/procedure-targetBodyStructure](http://hl7.org/fhir/extensions/StructureDefinition-procedure-targetBodyStructure.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>>,
    /** **[ProcedureOutcome](http://hl7.org/fhir/ValueSet/procedure-outcome); The result of procedure**

 The outcome of the procedure - did it resolve the 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 CodeableReference.concept.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<CodeableReference>>,
    /// 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>>,
    /** **[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 follow up 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 and comments about the procedure.

 */
    #[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>>,
    /** **Manipulated, implanted, or removed device**

 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>>,
    /** **[ProcedureUsed](http://hl7.org/fhir/ValueSet/device-type); 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.focalDevice.manipulated. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "used")]
    pub used: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_used")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub used_ext: Vec<Option<FieldExtension>>,
    /** **Extra information relevant to the procedure**

 Other resources from the patient record that may be relevant to the procedure.  The information from these resources was either used to create the instance or is provided to help with its interpretation. This extension should not be used if more specific inline elements or extensions are available.

 */
    #[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>>,
}
#[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 occurrence[x] field in Procedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the String type.
    #[serde(rename = "occurrenceString")]
    String(String),
    /// Variant accepting the Age type.
    #[serde(rename = "occurrenceAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "occurrenceRange")]
    Range(Range),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for ProcedureOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_occurrenceString")]
    String(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_occurrenceAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_occurrenceRange")]
    Range(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/// Choice of types for the reported[x] field in Procedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureReported {
    /// Variant accepting the Boolean type.
    #[serde(rename = "reportedBoolean")]
    Boolean(bool),
    /// Variant accepting the Reference type.
    #[serde(rename = "reportedReference")]
    Reference(Reference),
}
/// Extension value for ProcedureReported.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureReportedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_reportedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reportedReference")]
    Reference(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); Type of performance**

 Distinguishes the type of involvement of the performer in the procedure. For example, surgeon, anaesthetist, endoscopist.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who performed the procedure**

 Indicates who or what performed 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 Patient, RelatedPerson, Device, CareTeam, and HealthcareService was acting on behalf of.

 Organization, Patient, RelatedPerson, Device, CareTeam, and HealthcareService can be associated with multiple organizations. This element indicates which organization they were acting on behalf of when performing the action. */
    #[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>,
    /** **When the performer performed the procedure**

 Time period during which the performer performed the procedure.

 */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** 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.

 **[Provenance](http://hl7.org/fhir/StructureDefinition/Provenance) v5.0.0**

 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>);
/** 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.

 **[Provenance](http://hl7.org/fhir/StructureDefinition/Provenance) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 might 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 might 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(flatten)]
    pub occurred: Option<ProvenanceOccurred>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurred_ext: Option<ProvenanceOccurredExtension>,
    /** **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(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorded")]
    pub recorded: Option<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://terminology.hl7.org/ValueSet/v3-PurposeOfUse); Authorization (purposeOfUse) related to the event**

 The authorization (e.g., PurposeOfUse) that was used during the event being recorded.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorization")]
    pub authorization: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authorization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authorization_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<CodeableConcept>,
    /// 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>,
    /** **Workflow authorization within which this event occurred**

 Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.

 */
    #[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>>,
    /** **The patient is the subject of the data created/updated (.target) by the activity**

 The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.

 */
    #[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>,
    /** **Encounter within which this event occurred or which the event is tightly associated**

 This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (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 = "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>,
    /** **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.

 */
    #[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
    }
}
/// Choice of types for the occurred[x] field in Provenance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceOccurred {
    /// Variant accepting the Period type.
    #[serde(rename = "occurredPeriod")]
    Period(Period),
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurredDateTime")]
    DateTime(DateTime),
}
/// Extension value for ProvenanceOccurred.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceOccurredExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurredPeriod")]
    Period(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurredDateTime")]
    DateTime(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProvenanceAgentType](http://hl7.org/fhir/ValueSet/participation-role-type); How the agent participated**

 The Functional Role of the agent with respect to the activity.

 For example: assembler, author, prescriber, signer, investigator, 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>,
    /** **[ProvenanceAgentRole](http://hl7.org/fhir/ValueSet/security-role-type); What the agents role was**

 The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.

 For example: Chief-of-Radiology, Nurse, Physician, Medical-Student, 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>>,
    /** **The agent that participated in the event**

 Indicates who or what performed in the event.

 */
    #[serde(rename = "who")]
    pub who: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_who")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub who_ext: Option<FieldExtension>,
    /** **The agent that delegated**

 The agent that delegated authority to perform the activity performed by the agent.who element.

 */
    #[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 ProvenanceAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProvenanceAgentBuilder {
        ProvenanceAgentBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); revision | quotation | source | instantiates | 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.

 whatIdentity should be used for entities that are not a Resource type. */
    #[serde(rename = "what")]
    pub what: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_what")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub what_ext: Option<FieldExtension>,
    /** **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 used 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()
    }
}
/** 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.

 **[Questionnaire](http://hl7.org/fhir/StructureDefinition/Questionnaire) v5.0.0**

 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>);
/** 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.

 **[Questionnaire](http://hl7.org/fhir/StructureDefinition/Questionnaire) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this questionnaire, represented as an absolute URI (globally unique)**

 An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found.

The name of the referenced questionnaire can be conveyed using the http://hl7.org/fhir/StructureDefinition/display extension. */
    #[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 identifier for 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, and can then 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 questionnaires that have the same url but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the questionnaire with the format. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<QuestionnaireVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<QuestionnaireVersionAlgorithmExtension>,
    /** **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 alphanumeric type no-whitespace name to ensure that it is machine-processing 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>,
    /** **Based on Questionnaire**

 The URL of a Questionnaire that this Questionnaire is based on.

 This element covers a broad range of relationships, from 'somewhat inspired by' to 'fully compliant with'.         There is a standard extensionthat allows clearer differentiation between the specifics of the derivation relationship where          this is needed - e.g. to determine substitutability and validation expectations -          [http://hl7.org/fhir/StructureDefinition/questionnaire-derivationType](http://hl7.org/fhir/extensions/StructureDefinition-questionnaire-derivationType.html). */
    #[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<String>>,
    /// 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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The current state of this questionnaire.

 A nominal state-transition diagram can be found in the] documentation

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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 for genuine usage.

 Allows filtering of questionnaires that are appropriate for use versus not. */
    #[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>,
    /** **[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<String>>,
    /// 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>>,
    /** **Date last changed**

 The date  (and optionally time) when the questionnaire was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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>,
    /** **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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 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 questionnaire is presumed to be the predominant language in the place the questionnaire 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaires.

 When multiple useContexts are specified, there is no expectation that all or even 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 questionnaire is defined**

 Explanation 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>,
    /** **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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 questionnaire intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[QuestionnaireConcept](http://hl7.org/fhir/ValueSet/questionnaire-questions); Concept that represents the overall questionnaire**

 An identifier for this collection 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>>,
    /** **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
    }
}
/// Choice of types for the versionAlgorithm[x] field in Questionnaire
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for QuestionnaireVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

LinkIds can have whitespaces and slashes by design. Tooling should not rely on linkIds being valid XHTML element IDs, and should not directly embed them as such */
    #[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**

 This element is a URI that refers to an [ElementDefinition](elementdefinition.html) or to an [ObservationDefinition](observationdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.

 The uri refers to an ElementDefinition in a [StructureDefinition](structuredefinition.html#) or to an [ObservationDefinition](observationdefinition.html) and always starts with the [canonical URL](references.html#canonical) for the target resource. When referring to a StructureDefinition, a fragment identifier is used to specify the element definition by its id [Element.id](types-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. */
    #[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.

 When using this element to represent the name of a section, use group type item and also make sure to limit the text element to a short string suitable for display as a section heading.  Group item instructions should be included as a display type item within the group. */
    #[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, Coding, 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 interpretation is driven by enableBehavior (either all repetitions must evaluate to true for this item to be enabled, or only one must evaluate to true for the item to be enabled).  If the enableWhen.question has multiple answers, the condition evaluates to true if *any* of the answers for the referenced item match the enableWhen condition.  This element is a modifier because if enableWhen is present for an item, "required" is ignored unless one of the enableWhen conditions is met. When an item is disabled, all of its descendants are disabled, regardless of what their own enableWhen logic might evaluate to.  If enableWhen logic depends on an item that is disabled, the logic should proceed as though the item is not valued - even if a default value or other value might be retained in memory in the event of the item being re-enabled.  In some cases, the comparison between the indicated answer and the specified value may differ only by precision.  For example, the enableWhen might be Q1 > 1970, but the answer to Q1 is 1970-10-15.  There is not a clear answer as to whether 1970-10-15 should be considered 'greater' than 1970, given that it is an imprecise value.  In these indeterminate situations, the form filler has the option of refusing to render the form.  If the form **is** displayed, items where enableWhen is indeterminate SHOULD be treated as enabled with a warning indicating that the questionnaire logic was faulty and it is possible that the item should not be enabled.  Questionnaires SHOULD be designed to take into account challenges around varying precision to minimize non-deterministic situations by setting constraints around expected precision, etc. */
    #[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>>,
    /** **[EnableWhenBehavior](http://hl7.org/fhir/ValueSet/questionnaire-enable-behavior); all | any**

 Controls how multiple enableWhen values are interpreted -  whether all or any must be true.

 This element must be specified if more than one enableWhen value is provided. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enableBehavior")]
    pub enable_behavior: Option<codes::EnableWhenBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enableBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enable_behavior_ext: Option<FieldExtension>,
    /** **[DisabledDisplay](http://hl7.org/fhir/ValueSet/questionnaire-disabled-display); hidden | protected**

 Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.

 If not specified, rendering behavior is up to the client.  This element is only meaningful if enableWhen or an equivalent extension is present */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disabledDisplay")]
    pub disabled_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disabledDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disabled_display_ext: 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.

 If the required item is a question, it must have a direct answer (i.e. an answer to the question itself, not merely answers to child questions) in order for the QuestionnaireResponse to be complete.  If the required item is a group, it must have at least one descendant question which has an answer  Questionnaire.item.required only has meaning for elements that are conditionally enabled with enableWhen if the condition evaluates to true.  It also only has meaning if the parent element is present.  If a non-required 'group' item contains a 'required' question item, it's completely fine to omit the group (because it's not required) despite it having a required child.  Similarly, 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 descendant item with a populated answer). The value for 'required' 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 a QuestionnaireResponse for this item may include multiple answers associated with a single instance of this item (for question-type items) or multiple repetitions of the item (for group-type items).

 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 (i.e. "repeat the question") or to simply allow entry/selection of multiple answers for the question (repeat the answers).  Which is most appropriate visually may depend on the type of answer as well as whether there are nested items.

The resulting QuestionnaireResponse will be populated the same way regardless of rendering - one 'question' item with multiple answer values.

 The value may come from the ElementDefinition referred to by .definition.  When repeats=true for a group, it'll be represented with multiple items with the same linkId in the QuestionnaireResponse.  For a question, it'll be represented by a single item with that linkId with multiple answers. */
    #[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.

 If specified on a 'group', then all items beneath the specified group are read only.  For questions, this only marks the answer associated with the specific item read only.  Descendant questions are not impacted.  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 these 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>,
    /** **[QuestionnaireAnswerConstraint](http://hl7.org/fhir/ValueSet/questionnaire-answer-constraint); optionsOnly | optionsOrType | optionsOrString**

 For items that have a defined set of allowed answers (via answerOption or answerValueSet), indicates whether values *other* than those specified can be selected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "answerConstraint")]
    pub answer_constraint: Option<codes::QuestionnaireAnswerConstraint>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_answerConstraint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub answer_constraint_ext: Option<FieldExtension>,
    /** **ValueSet containing permitted answers**

 A reference to a value set containing a list of values representing permitted answers for a question.

 LOINC defines many useful value sets for questionnaire responses. See [LOINC Answer Lists](https://terminology.hl7.org/LOINC.html). 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 = "answerValueSet")]
    pub answer_value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_answerValueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub answer_value_set_ext: Option<FieldExtension>,
    /** **Permitted answer**

 One of the permitted answers for the question.

 This element can be used when the value set machinery of answerValueSet is deemed too cumbersome or when there's a need to capture possible answers that are not codes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "answerOption")]
    pub answer_option: Vec<Option<QuestionnaireItemAnswerOption>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_answerOption")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub answer_option_ext: Vec<Option<FieldExtension>>,
    /** **Initial value(s) when item is first rendered**

 One or more values that should be pre-populated in the answer 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 initial values can influence results.  The data type of initial.answer[x] must agree with the item.type, and only repeating items can have more then one initial value. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "initial")]
    pub initial: Vec<Option<QuestionnaireItemInitial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_initial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub initial_ext: Vec<Option<FieldExtension>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 linkId of question that determines whether item is enabled/disabled**

 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.  If there are multiple items with the same linkId and all are equadistant (e.g. a question references a question that appears in a separate repeating group), that is an error.  (Consider using the enableWhenExpression extension to define logic to handle such a situation.) */
    #[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>,
    /** **[QuestionnaireItemOperator](http://hl7.org/fhir/ValueSet/questionnaire-enable-operator); exists | = | != | > | < | >= | <=**

 Specifies the criteria by which the question is enabled.

 */
    #[serde(rename = "operator")]
    pub operator: codes::QuestionnaireItemOperator,
    /// 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>,
    /** **Value for question comparison based on operator**

 A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.

 */
    #[serde(flatten)]
    pub answer: 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 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 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 answerOption 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 = "QuestionnaireItemAnswerOptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireItemAnswerOption {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: QuestionnaireItemAnswerOptionValue,
    /// 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<QuestionnaireItemAnswerOptionValueExtension>,
    /** **Whether option is selected by default**

 Indicates whether the answer value is selected when the list of possible answers is initially shown.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "initialSelected")]
    pub initial_selected: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_initialSelected")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub initial_selected_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl QuestionnaireItemAnswerOption {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireItemAnswerOptionBuilder {
        QuestionnaireItemAnswerOptionBuilder::default()
    }
}
/// Choice of types for the value[x] field in QuestionnaireItemAnswerOption
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemAnswerOptionValue {
    /// 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),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for QuestionnaireItemAnswerOptionValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemAnswerOptionValueExtension {
    /// 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),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the initial 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 = "QuestionnaireItemInitialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireItemInitial {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Actual value for initializing the question**

 The actual value to for an initial answer.

 The type of the initial value must be consistent with the type of the item. */
    #[serde(flatten)]
    pub value: QuestionnaireItemInitialValue,
    /// 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<QuestionnaireItemInitialValueExtension>,
}
#[cfg(feature = "builders")]
impl QuestionnaireItemInitial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireItemInitialBuilder {
        QuestionnaireItemInitialBuilder::default()
    }
}
/// Choice of types for the value[x] field in QuestionnaireItemInitial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemInitialValue {
    /// 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 QuestionnaireItemInitialValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemInitialValueExtension {
    /// 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),
}
/** 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.

 **[QuestionnaireResponse](http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) v5.0.0**

 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>);
/** 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.

 **[QuestionnaireResponse](http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 this set of answers**

 Business identifiers assigned to this questionnaire response by the performer and/or other systems.  These identifiers remain constant as the resource is updated and propagates from server to server.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#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>>,
    /** **Request fulfilled by this QuestionnaireResponse**

 A plan, proposal or order that is fulfilled in whole or in part by this questionnaire response.  For example, a ServiceRequest 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 referenced event**

 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.

 Not to be used to link an questionnaire response to an Encounter - use 'context' for that.

Composition of questionnaire responses will be handled using the Assemble operation defined in the SDC IG.  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 = "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>>,
    /** **Canonical URL of Questionnaire being answered**

 The Questionnaire that defines and organizes the questions for which answers are being provided.

 If a QuestionnaireResponse references a Questionnaire that can be resolved, 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.).  It is possible to have a QuestionnaireResponse whose 'questionnaire' element does not resolve.  It is also possible for the questionnaire element to not have a value but only extensions (e.g. conveying the title or identifier for the questionnaire).  This may happen for legacy data.  If there is no formally defined Questionnaire, it is undefined what the 'correct' values for the linkId elements should be and it is possible that linkIds might be inconsistent for QuestionnaireResponses for the same form if captured by distinct systems. */
    #[serde(rename = "questionnaire")]
    pub questionnaire: String,
    /// 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 current state of the questionnaire response.

 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. */
    #[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 the questionnaire response is part of**

 The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.

 This will typically be the encounter the questionnaire response was created during, but some questionnaire responses may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission forms).  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 = "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 the answers were gathered**

 The date and/or time that this questionnaire response was last modified by the user - e.g. changing answers or revising status.

 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 might 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>,
    /** **The individual or device that received and recorded the answers**

 The individual or device that 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. Device should only be used if it directly determined the answers, not if it was merely used as a capture tool to record answers provided by others. In the latter case, information about the physical device, software, etc. would be captured using Provenance. */
    #[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 individual or device that answered the questions**

 The individual or device that answered the questions about the subject.

 If not specified, no inference can be made about who provided the data. Device should only be used if it directly determined the answers, not if it was merely used as a capture tool to record answers provided by others. In the latter case, information about the physical device, software, etc. would be captured using Provenance. */
    #[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).\nWhen dealing with repeating items, each group repetition will be handled by a separate item.  However, repeating questions are handled with a single question item and potentially multiple answers. */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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#), 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.

 The text for an item SHOULD be identical to the text from the corresponding Questionnaire.item. This can't be strictly enforced because it's possible for the Questionnaire to be updated subsequent to the QuestionnaireResponse having been created, however the intention is that the text in the QuestionnaireResponse reflects what the user saw when completing the Questionnaire. */
    #[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 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>>,
    /** **Child items of group item**

 Sub-questions, sub-groups or display items nested beneath a group.

 Only used when nesting beneath a group - see item.answer.item for nesting beneath questions */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. Must match the datatype specified by Questionnaire.item.type in the corresponding Questionnaire.     Note that a question is answered using one of the possible choices defined with answerOption, answerValueSet or some other means and the answer has a complex data type, all elements within the answer in the QuestionnaireResponse **SHOULD** match the elements defined corresponding choice value in the Questionnaire.  However, it is possible that not all elements will be propagated.  Also, some systems might use language translations resulting in different displays.  Comparison of value to the values defined in the Questionnaire (whether by answerOption, answerValueSet or answerExpression) **SHALL NOT** pay attention to Coding.display, Reference.display, Quantity.unit unless those are the only elements present.  As well, systems are not required to check for a match on any extensions (e.g. ordinal values, translations, etc.).  Systems **MAY** enforce that if extensions such as ordinal values are present in both Questionnaire and QuestionnaireResponse, they match. */
    #[serde(flatten)]
    pub value: 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>,
    /** **Child items of question**

 Nested groups and/or questions found within this particular answer.

 Only used when nesting beneath a question - see item.item for nesting beneath groups */
    #[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),
}
/** Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity that is cited in a guidance, regulation, rule or legislative act. An example is Market Authorization relating to a Medicinal Product.

 **[RegulatedAuthorization](http://hl7.org/fhir/StructureDefinition/RegulatedAuthorization) v5.0.0**

 Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity e.g. Market Authorization for a Medicinal Product

 Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity that is cited in a guidance, regulation, rule or legislative act. An example is Market Authorization relating to a Medicinal Product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct RegulatedAuthorization(pub Box<RegulatedAuthorizationInner>);
/** Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity that is cited in a guidance, regulation, rule or legislative act. An example is Market Authorization relating to a Medicinal Product.

 **[RegulatedAuthorization](http://hl7.org/fhir/StructureDefinition/RegulatedAuthorization) v5.0.0**

 Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity e.g. Market Authorization for a Medicinal Product

 Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity that is cited in a guidance, regulation, rule or legislative act. An example is Market Authorization relating to a Medicinal Product.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RegulatedAuthorizationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RegulatedAuthorizationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "RegulatedAuthorization::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::RegulatedAuthorization", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 authorization, typically assigned by the authorizing body**

 Business identifier for the authorization, typically assigned by the authorizing body.

 */
    #[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>>,
    /** **The product type, treatment, facility or activity that is being authorized**

 The product type, treatment, facility or activity that is being authorized.

 */
    #[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>>,
    /** **[RegulatedAuthorizationType](http://hl7.org/fhir/ValueSet/regulated-authorization-type); Overall type of this authorization, for example drug marketing approval, orphan drug designation**

 Overall type of this authorization, for example drug marketing approval, orphan drug designation.

 */
    #[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>,
    /** **General textual supporting information**

 General textual supporting information.

 */
    #[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>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); The territory in which the authorization has been granted**

 The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "region")]
    pub region: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_region")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub region_ext: Vec<Option<FieldExtension>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications**

 The status that is authorised e.g. approved. Intermediate states and actions can be tracked with cases and applications.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 date at which the current status was assigned**

 The date at which the current status was assigned.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<DateTime>,
    /// 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>,
    /** **The time period in which the regulatory approval etc. is in effect, e.g. a Marketing Authorization includes the date of authorization and/or expiration date**

 The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.

 */
    #[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>,
    /** **Condition for which the use of the regulated product applies**

 Condition for which the use of the regulated product applies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[ProductIntendedUse](http://hl7.org/fhir/ValueSet/product-intended-use); The intended use of the product, e.g. prevention, treatment**

 The intended use of the product, e.g. prevention, treatment, diagnosis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedUse")]
    pub intended_use: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intendedUse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intended_use_ext: Option<FieldExtension>,
    /** **[RegulatedAuthorizationBasis](http://hl7.org/fhir/ValueSet/regulated-authorization-basis); The legal/regulatory framework or reasons under which this authorization is granted**

 The legal or regulatory framework against which this authorization is granted, or other reasons for it.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **The organization that has been granted this authorization, by the regulator**

 The organization that has been granted this authorization, by some authoritative body (the 'regulator').

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "holder")]
    pub holder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_holder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub holder_ext: Option<FieldExtension>,
    /** **The regulatory authority or authorizing body granting the authorization**

 The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "regulator")]
    pub regulator: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_regulator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub regulator_ext: Option<FieldExtension>,
    /** **Additional information or supporting documentation about the authorization**

 Additional information or supporting documentation about the authorization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attachedDocument")]
    pub attached_document: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attachedDocument")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attached_document_ext: Vec<Option<FieldExtension>>,
    /** **The case or regulatory procedure for granting or amending a regulated authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page)**

 The case or regulatory procedure for granting or amending a regulated authorization. An authorization is granted in response to submissions/applications by those seeking authorization. A case is the administrative process that deals with the application(s) that relate to this and assesses them. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "case")]
    pub case: Option<RegulatedAuthorizationCase>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_case")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub case_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RegulatedAuthorizationBuilder {
    #[doc = concat!("Finalize building ", "RegulatedAuthorization", ".")]
    pub fn build(self) -> Result<RegulatedAuthorization, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RegulatedAuthorizationInner> for RegulatedAuthorization {
    fn from(inner: RegulatedAuthorizationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for RegulatedAuthorization {
    type Target = RegulatedAuthorizationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for RegulatedAuthorization {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl RegulatedAuthorization {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RegulatedAuthorizationBuilder {
        RegulatedAuthorizationBuilder::default()
    }
}
impl RegulatedAuthorization {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::RegulatedAuthorization
    }
}
/// Sub-fields of the case field in RegulatedAuthorization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RegulatedAuthorizationCaseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RegulatedAuthorizationCase {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 by which this case can be referenced**

 Identifier by which this case can be referenced.

 */
    #[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>,
    /** **[RegulatedAuthorizationCaseType](http://hl7.org/fhir/ValueSet/regulated-authorization-case-type); The defining type of case**

 The defining type of case.

 */
    #[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); The status associated with the case**

 The status associated with the case.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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>,
    /** **Relevant date for this case**

 Relevant date for this case.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub date: Option<RegulatedAuthorizationCaseDate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<RegulatedAuthorizationCaseDateExtension>,
    /** **Applications submitted to obtain a regulated authorization. Steps within the longer running case or procedure**

 A regulatory submission from an organization to a regulator, as part of an assessing case. Multiple applications may occur over time, with more or different information to support or modify the submission or the authorization. The applications can be considered as steps within the longer running case or procedure for this authorization process.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "application")]
    pub application: Vec<Option<RegulatedAuthorizationCase>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_application")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub application_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl RegulatedAuthorizationCase {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RegulatedAuthorizationCaseBuilder {
        RegulatedAuthorizationCaseBuilder::default()
    }
}
/// Choice of types for the date[x] field in RegulatedAuthorizationCase
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RegulatedAuthorizationCaseDate {
    /// Variant accepting the Period type.
    #[serde(rename = "datePeriod")]
    Period(Period),
    /// Variant accepting the DateTime type.
    #[serde(rename = "dateDateTime")]
    DateTime(DateTime),
}
/// Extension value for RegulatedAuthorizationCaseDate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RegulatedAuthorizationCaseDateExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_datePeriod")]
    Period(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_dateDateTime")]
    DateTime(FieldExtension),
}
/** Information about a person that is involved in a patient's health or the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.

 **[RelatedPerson](http://hl7.org/fhir/StructureDefinition/RelatedPerson) v5.0.0**

 A person that is related to a patient, but who is not a direct target of care

 Information about a person that is involved in a patient's health or 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>);
/** Information about a person that is involved in a patient's health or the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.

 **[RelatedPerson](http://hl7.org/fhir/StructureDefinition/RelatedPerson) v5.0.0**

 A person that is related to a patient, but who is not a direct target of care

 Information about a person that is involved in a patient's health or 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 RelatedPerson identifiers might not be unique across instances within a system, as a single human individual may be represented as many different RelatedPerson resources with different roles, periods, or relationships. */
    #[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 relationship of the related person to the patient**

 The nature of the relationship between the related person and the patient.

 The directionality of the relationship is from the RelatedPerson to the Patient. For example, if the Patient is a child, and the RelatedPerson is the mother, the relationship would be PRN (parent) or MTH (mother). */
    #[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 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 during which this relationship is or was active. If there are no dates defined, then the interval is unknown.

 If an individual has a relationship with a patient over multiple, non-adjacent periods, there should be a distinct RelatedPerson instance for each period.  For example, if a person is a roommate for a period of time, moves out, and is later a roommate with the same person again, you would have two RelatedPerson instances. */
    #[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>,
    /** **A language which may be used to communicate with the related person about the patient's health**

 A language which may be used to communicate with the related person about the patient's 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 RelatedPerson.Communication associations.   If the RelatedPerson 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<RelatedPersonCommunication>>,
    /// 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 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
    }
}
/// Sub-fields of the communication field in RelatedPerson
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RelatedPersonCommunicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RelatedPersonCommunication {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-languages); The language which can be used to communicate with the related person about the patient's 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-AU" for Australian 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 related person prefers this language (over other languages he or she 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 RelatedPersonCommunication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RelatedPersonCommunicationBuilder {
        RelatedPersonCommunicationBuilder::default()
    }
}
/** A set of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".

 **[RequestOrchestration](http://hl7.org/fhir/StructureDefinition/RequestOrchestration) v5.0.0**

 A set of related requests

 A set 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 RequestOrchestration(pub Box<RequestOrchestrationInner>);
/** A set of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".

 **[RequestOrchestration](http://hl7.org/fhir/StructureDefinition/RequestOrchestration) v5.0.0**

 A set of related requests

 A set 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 = "RequestOrchestrationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RequestOrchestrationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "RequestOrchestration::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::RequestOrchestration", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 FHIR protocol or definition**

 A canonical URL referencing a FHIR-defined 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 = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 A URL referencing an externally defined 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 = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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 multiple independent Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 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 | on-hold | revoked | completed | entered-in-error | unknown**

 The current state of the request. For request orchestrations, the status reflects the status of all the requests in the orchestration.

 */
    #[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 | directive | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.

 */
    #[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>,
    /** **[RequestCode](http://hl7.org/fhir/ValueSet/action-code); What's being requested/ordered**

 A code that identifies what the overall request orchestration is.

 This element can be used to provide a code that captures the meaning of the request orchestration as a whole, as opposed to the code of the action element, which captures the meaning of the individual actions within the request orchestration. */
    #[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 request orchestration is about**

 The subject for which the request orchestration 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>,
    /** **Created as part of**

 Describes the context of the request orchestration, if any.

 */
    #[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 request orchestration was authored**

 Indicates when the request orchestration 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 orchestration**

 Provides a reference to the author of the request orchestration.

 */
    #[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>,
    /** **[ActionReasonCode](http://hl7.org/fhir/ValueSet/action-reason-code); Why the request orchestration is needed**

 Describes the reason for the request orchestration in coded or textual form.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **What goals**

 Goals that are intended to be achieved by following the requests in this RequestOrchestration.

 */
    #[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>>,
    /** **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<RequestOrchestrationAction>>,
    /// 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 RequestOrchestrationBuilder {
    #[doc = concat!("Finalize building ", "RequestOrchestration", ".")]
    pub fn build(self) -> Result<RequestOrchestration, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RequestOrchestrationInner> for RequestOrchestration {
    fn from(inner: RequestOrchestrationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for RequestOrchestration {
    type Target = RequestOrchestrationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for RequestOrchestration {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl RequestOrchestration {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RequestOrchestrationBuilder {
        RequestOrchestrationBuilder::default()
    }
}
impl RequestOrchestration {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::RequestOrchestration
    }
}
/// Sub-fields of the action field in RequestOrchestration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationAction {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the PlanDefinition**

 The linkId of the action from the PlanDefinition that corresponds to this action in the RequestOrchestration resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **User-visible prefix for the action (e.g. 1. or A.)**

 A user-visible prefix for the action. For example a section or item numbering such as 1. or A.

 */
    #[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>,
    /** **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 might 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>,
    /** **[RequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the action should be addressed with respect to other actions.

 */
    #[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>,
    /** **[ActionCode](http://hl7.org/fhir/ValueSet/action-code); 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 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>>,
    /** **What goals**

 Goals that are intended to be achieved by following the requests in this action.

 */
    #[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>>,
    /** **Whether or not the action is applicable**

 An expression that describes applicability criteria, or start/stop conditions for the action.

 When multiple conditions of the same kind are present, the effects are combined using AND semantics, so the overall condition is true only if all of the conditions are true. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<RequestOrchestrationActionCondition>>,
    /// 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<RequestOrchestrationActionInput>>,
    /// 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<RequestOrchestrationActionOutput>>,
    /// 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".

 */
    #[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<RequestOrchestrationActionRelatedAction>>,
    /// 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.

 The intent of the timing element is to provide timing for when the action should be performed. The timing may be absolute (specified as a dateTime or Period) or relative (specified as an Age, Duration, or Range), or it may be a more complex, potentially repeating timing specified using Timing. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<RequestOrchestrationActionTiming>,
    /// 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<RequestOrchestrationActionTimingExtension>,
    /** **Where it should happen**

 Identifies the facility where the action 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<CodeableReference>,
    /// 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 perform the action**

 The participant that should perform or be responsible for this action.

 Because request orchestrations represent potential options for performing activities, some specific participants may still be unknown, so this element allows for both definitional participants (in the same way they are specified in ActivityDefinition and PlanDefinition resources) as well as identifying specific participants when they are known. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<RequestOrchestrationActionParticipant>>,
    /// 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<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>,
    /** **[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 expectations around whether an action is required.

 */
    #[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>,
    /** **Description of the activity to be performed**

 A reference to an ActivityDefinition that describes the action to be taken in detail, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.

 Note that the definition is optional, and if no definition is specified, a dynamicValue with a root ($this) 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(flatten)]
    pub definition: Option<RequestOrchestrationActionDefinition>,
    /// 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<RequestOrchestrationActionDefinitionExtension>,
    /** **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.

 Note that when a referenced ActivityDefinition also defines a transform, the transform specified here generally takes precedence. In addition, if both a transform and dynamic values are specific, the dynamic values are applied to the result of the transform. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<String>,
    /// 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.

 Dynamic values are applied in the order in which they are defined in the RequestOrchestration resource. Note that when dynamic values are also specified by a referenced ActivityDefinition, the dynamicValues from the ActivityDefinition are applied first, followed by the dynamicValues specified here. In addition, if both a transform and dynamic values are specific, the dynamic values are applied to the result of the transform. */
    #[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<RequestOrchestrationActionDynamicValue>>,
    /// 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>>,
    /** **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<RequestOrchestrationAction>>,
    /// 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 RequestOrchestrationAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionBuilder {
        RequestOrchestrationActionBuilder::default()
    }
}
/// Sub-fields of the condition field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionConditionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionCondition {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **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<Expression>,
    /// 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 RequestOrchestrationActionCondition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionConditionBuilder {
        RequestOrchestrationActionConditionBuilder::default()
    }
}
/// Sub-fields of the input field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionInput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 title**

 A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.

 */
    #[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>,
    /** **What data is provided**

 Defines the data that is to be provided as input to the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<DataRequirement>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **What data is provided**

 Points to an existing input or output element that provides data to this input.

 The relatedData element allows indicating that an input to a parent action is an input to specific child actions. It also allows the output of one action to be identified as the input to a different action */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedData")]
    pub related_data: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedData")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_data_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RequestOrchestrationActionInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionInputBuilder {
        RequestOrchestrationActionInputBuilder::default()
    }
}
/// Sub-fields of the output field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionOutputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionOutput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 title**

 A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.

 */
    #[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>,
    /** **What data is provided**

 Defines the data that results as output from the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<DataRequirement>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **What data is provided**

 Points to an existing input or output element that is results as output from the action.

 The relatedData element allows indicating that the output of child action is also the output of a parent action. It also allows the input of one action to be identified as the output of a different action */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedData")]
    pub related_data: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedData")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_data_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RequestOrchestrationActionOutput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionOutputBuilder {
        RequestOrchestrationActionOutputBuilder::default()
    }
}
/// Sub-fields of the relatedAction field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionRelatedActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionRelatedAction {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 target related action.

 */
    #[serde(rename = "targetId")]
    pub target_id: 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>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | 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>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end**

 The relationship of the end of this action to the related action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endRelationship")]
    pub end_relationship: Option<codes::ActionRelationshipType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endRelationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_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<RequestOrchestrationActionRelatedActionOffset>,
    /// 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<RequestOrchestrationActionRelatedActionOffsetExtension>,
}
#[cfg(feature = "builders")]
impl RequestOrchestrationActionRelatedAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionRelatedActionBuilder {
        RequestOrchestrationActionRelatedActionBuilder::default()
    }
}
/// Choice of types for the offset[x] field in RequestOrchestrationActionRelatedAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionRelatedActionOffset {
    /// Variant accepting the Duration type.
    #[serde(rename = "offsetDuration")]
    Duration(Duration),
    /// Variant accepting the Range type.
    #[serde(rename = "offsetRange")]
    Range(Range),
}
/// Extension value for RequestOrchestrationActionRelatedActionOffset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionRelatedActionOffsetExtension {
    /// 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 RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionTiming {
    /// Variant accepting the DateTime type.
    #[serde(rename = "timingDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Age type.
    #[serde(rename = "timingAge")]
    Age(Age),
    /// 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 RequestOrchestrationActionTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionTimingExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timingDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_timingAge")]
    Age(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 RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionParticipant {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson**

 The type of participant in the action.

 */
    #[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::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>,
    /** **Who or what can participate**

 The type of participant in the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeCanonical")]
    pub type_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_canonical_ext: Option<FieldExtension>,
    /** **Who or what can participate**

 The type of participant in the action.

 When this element is a reference, it SHOULD be a reference to a definitional resource (for example, a location type, rather than a specific location). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeReference")]
    pub type_reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeReference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_reference_ext: Option<FieldExtension>,
    /** **[ActivityParticipantRole](http://terminology.hl7.org/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>,
    /** **[ActionParticipantFunction](http://hl7.org/fhir/ValueSet/action-participant-function); E.g. Author, Reviewer, Witness, etc**

 Indicates how the actor will be involved in the action - author, reviewer, witness, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who/what is participating?**

 A reference to the actual participant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub actor: Option<RequestOrchestrationActionParticipantActor>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<RequestOrchestrationActionParticipantActorExtension>,
}
#[cfg(feature = "builders")]
impl RequestOrchestrationActionParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionParticipantBuilder {
        RequestOrchestrationActionParticipantBuilder::default()
    }
}
/// Choice of types for the actor[x] field in RequestOrchestrationActionParticipant
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionParticipantActor {
    /// Variant accepting the Canonical type.
    #[serde(rename = "actorCanonical")]
    Canonical(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "actorReference")]
    Reference(Reference),
}
/// Extension value for RequestOrchestrationActionParticipantActor.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionParticipantActorExtension {
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_actorCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_actorReference")]
    Reference(FieldExtension),
}
/// Choice of types for the definition[x] field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionDefinition {
    /// Variant accepting the Canonical type.
    #[serde(rename = "definitionCanonical")]
    Canonical(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "definitionUri")]
    Uri(String),
}
/// Extension value for RequestOrchestrationActionDefinition.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestOrchestrationActionDefinitionExtension {
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_definitionCanonical")]
    Canonical(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_definitionUri")]
    Uri(FieldExtension),
}
/// Sub-fields of the dynamicValue field in RequestOrchestrationAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestOrchestrationActionDynamicValueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestOrchestrationActionDynamicValue {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).

 To specify the path to the current action being realized, the %action environment variable is available in this path. For example, to specify the description element of the target action, the path would be %action.description. The path attribute contains a [Simple FHIRPath Subset](fhirpath.html#simple) that allows path traversal, but not calculation. */
    #[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>,
    /** **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<Expression>,
    /// 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 RequestOrchestrationActionDynamicValue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestOrchestrationActionDynamicValueBuilder {
        RequestOrchestrationActionDynamicValueBuilder::default()
    }
}
/** The Requirements resource is used to describe an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 **[Requirements](http://hl7.org/fhir/StructureDefinition/Requirements) v5.0.0**

 A set of requirements - features of systems that are necessary

 A set of requirements - a list of features or behaviors of designed systems that are necessary to achieve organizational or regulatory goals.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Requirements(pub Box<RequirementsInner>);
/** The Requirements resource is used to describe an actor - a human or an application that plays a role in data exchange, and that may have obligations associated with the role the actor plays.

 **[Requirements](http://hl7.org/fhir/StructureDefinition/Requirements) v5.0.0**

 A set of requirements - features of systems that are necessary

 A set of requirements - a list of features or behaviors of designed systems that are necessary to achieve organizational or regulatory goals.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequirementsBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RequirementsInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Requirements::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Requirements", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this Requirements, represented as a URI (globally unique)**

 An absolute URI that is used to identify this Requirements when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this Requirements is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the Requirements is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 Requirements (business identifier)**

 A formal identifier that is used to identify this Requirements when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **Business version of the Requirements**

 The identifier that is used to identify this version of the Requirements when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the Requirements 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 Requirements instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the Requirements with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<RequirementsVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<RequirementsVersionAlgorithmExtension>,
    /** **Name for this Requirements (computer friendly)**

 A natural language name identifying the Requirements. 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 alphanumeric type name to ensure that it is machine-processing 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 Requirements (human friendly)**

 A short, descriptive, user-friendly title for the Requirements.

 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 Requirements. Enables tracking the life-cycle of the content.

 Allows filtering of Requirements that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 Requirements is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of Requirements that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the Requirements was published. The date must change 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 Requirements changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the Requirements. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the Requirements.

 Usually an organization but may be an individual. The publisher (or steward) of the Requirements is the organization or individual primarily responsible for the maintenance and upkeep of the Requirements. 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 Requirements. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 requirements**

 A free text natural language description of the requirements.

 This description can be used for a general description of the requirements, and which covers why it was defined. */
    #[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 context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate Requirements instances.

 When multiple useContexts are specified, there is no expectation that 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 Requirements (if applicable)**

 A legal or geographic region in which the Requirements is intended to be used.

 It may be possible for the Requirements to be used in jurisdictions other than those for which it was originally designed or intended

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.). */
    #[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 Requirements is defined**

 Explanation of why this Requirements is needed and why it has been designed as it has.

 This element does not describe the usage of the Requirements. 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 Requirements. */
    #[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 Requirements and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the Requirements.

 ... */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Other set of Requirements this builds on**

 Another set of Requirements that this set of Requirements builds on and updates.

 Existing statements (by key) may be narrowed or clarified, and additional statements added. */
    #[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<String>>,
    /// 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>>,
    /** **External artifact (rule/document etc. that) created this set of requirements**

 A reference to another artifact that created this set of requirements. This could be a Profile, etc., or external regulation, or business requirements expressed elsewhere.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<Option<FieldExtension>>,
    /** **Actor for these requirements**

 An actor these requirements are in regard to.

 If more than one actor is specified, then it's up to the statements to describe in narrative if they don't apply to all actors. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Vec<Option<String>>,
    /// 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>>,
    /** **Actual statement as markdown**

 The actual statement of requirement, in markdown format.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statement")]
    pub statement: Vec<Option<RequirementsStatement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub statement_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl RequirementsBuilder {
    #[doc = concat!("Finalize building ", "Requirements", ".")]
    pub fn build(self) -> Result<Requirements, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RequirementsInner> for Requirements {
    fn from(inner: RequirementsInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Requirements {
    type Target = RequirementsInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Requirements {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Requirements {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RequirementsBuilder {
        RequirementsBuilder::default()
    }
}
impl Requirements {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Requirements
    }
}
/// Choice of types for the versionAlgorithm[x] field in Requirements
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequirementsVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for RequirementsVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequirementsVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the statement field in Requirements
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequirementsStatementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequirementsStatement {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Key that identifies this statement**

 Key that identifies this statement (unique within this resource).

 Refer directly to the statement by {url}#{key} */
    #[serde(rename = "key")]
    pub key: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_key")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub key_ext: Option<FieldExtension>,
    /** **Short Human label for this statement**

 A short human usable label for this statement.

 The key is intended for computers, while this is intended for humans. In its absence, the key should be convenient for a human to say (e.g. not a UUID) */
    #[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>,
    /** **[??](http://hl7.org/fhir/ValueSet/conformance-expectation); SHALL | SHOULD | MAY | SHOULD-NOT**

 A short human usable label for this statement.

 The conformance code is extracted from the requirement to make indexing and display easier. The requirement needs to express the conformance verbs directly in the markdown content. It's not unusual to mix verbs in a single sentence (e.g. System SHALL do X and SHOULD do Y) */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conformance")]
    pub conformance: Vec<Option<codes::ConformanceExpectation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_conformance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub conformance_ext: Vec<Option<FieldExtension>>,
    /** **Set to true if requirements statement is conditional**

 This boolean flag is set to true of the text of the requirement is conditional on something e.g. it includes lanauage like 'if x then y'. This conditionality flag is introduced for purposes of filtering and colour highlighting etc.

 There is no intent that the conditional statement by evaluatable */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conditionality")]
    pub conditionality: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditionality_ext: Option<FieldExtension>,
    /** **The actual requirement**

 The actual requirement for human consumption.

 */
    #[serde(rename = "requirement")]
    pub requirement: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **Another statement this clarifies/restricts ([url#]key)**

 Another statement on one of the requirements that this requirement clarifies or restricts.

 This can be just a key, if there is only one matching statement in the requirements statements referenced in Requirements.derivedFrom. If there is more than one, it should be in the format ```texturl#key``` */
    #[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>,
    /** **A larger requirement that this requirement helps to refine and enable**

 A larger requirement that this requirement helps to refine and enable.

 Follows the same convention as statement.derivedFrom, where a reference is the canonical of the Requirements followed by '#' and the 'key' of the specific requirement. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Option<String>,
    /// 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>,
    /** **Design artifact that satisfies this requirement**

 A reference to another artifact that satisfies this requirement. This could be a Profile, extension, or an element in one of those, or a CapabilityStatement, OperationDefinition, SearchParameter, CodeSystem(/code), ValueSet, Libary etc.

 This is for use when the requirement is met be a pre-existing artifact e.g. a rule that's met by the base FHIR spec, or a national implementation guide. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "satisfiedBy")]
    pub satisfied_by: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_satisfiedBy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub satisfied_by_ext: Vec<Option<FieldExtension>>,
    /** **External artifact (rule/document etc. that) created this requirement**

 A reference to another artifact that created this requirement. This could be a Profile, etc., or external regulation, or business requirements expressed elsewhere.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_ext: Vec<Option<FieldExtension>>,
    /** **Who asked for this statement**

 Who asked for this statement to be a requirement. By default, it's assumed that the publisher knows who it is if it matters.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl RequirementsStatement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequirementsStatementBuilder {
        RequirementsStatementBuilder::default()
    }
}
/** A scientific study of nature that sometimes includes processes involved in health and disease. For example, clinical trials are research studies that involve people. These studies may be related to new ways to screen, prevent, diagnose, and treat disease. They may also study certain outcomes and certain groups of people by looking at data collected in the past or future.

 **[ResearchStudy](http://hl7.org/fhir/StructureDefinition/ResearchStudy) v5.0.0**

 Investigation to increase healthcare-related patient-independent knowledge

 A scientific study of nature that sometimes includes processes involved in health and disease. For example, clinical trials are research studies that involve people. These studies may be related to new ways to screen, prevent, diagnose, and treat disease. They may also study certain outcomes and certain groups of people by looking at data collected in the past or future.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ResearchStudy(pub Box<ResearchStudyInner>);
/** A scientific study of nature that sometimes includes processes involved in health and disease. For example, clinical trials are research studies that involve people. These studies may be related to new ways to screen, prevent, diagnose, and treat disease. They may also study certain outcomes and certain groups of people by looking at data collected in the past or future.

 **[ResearchStudy](http://hl7.org/fhir/StructureDefinition/ResearchStudy) v5.0.0**

 Investigation to increase healthcare-related patient-independent knowledge

 A scientific study of nature that sometimes includes processes involved in health and disease. For example, clinical trials are research studies that involve people. These studies may be related to new ways to screen, prevent, diagnose, and treat disease. They may also study certain outcomes and certain groups of people by looking at data collected in the past or future.

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this study resource**

 Canonical identifier for this study resource, represented as a globally unique URI.

 */
    #[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 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>>,
    /** **The business version for the study record**

 The business version for the study record.

 */
    #[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 study (computer friendly)**

 Name for this study (computer 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>,
    /** **Human readable name of the study**

 The human readable name of the research 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>,
    /** **Additional names for the study**

 Additional names for the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "label")]
    pub label: Vec<Option<ResearchStudyLabel>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_label")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub label_ext: Vec<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>>,
    /** **References, URLs, and attachments**

 Citations, references, URLs and other related documents.  When using relatedArtifact to share URLs, the relatedArtifact.type will often be set to one of "documentation" or "supported-with" and the URL value will often be in relatedArtifact.document.url but another possible location is relatedArtifact.resource when it is a canonical URL.

 */
    #[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>>,
    /** **Date the resource last changed**

 The date (and optionally time) when the ResearchStudy Resource was last significantly changed. The date must change 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 ResearchStudy Resource changes.

 */
    #[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>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The publication state of the resource (not of the study).

 */
    #[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>,
    /** **[ResearchStudyPrimaryPurposeType](http://hl7.org/fhir/ValueSet/research-study-prim-purp-type); treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility**

 The type of study based upon the intent of the study activities. A classification of the intent of the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "primaryPurposeType")]
    pub primary_purpose_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_primaryPurposeType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub primary_purpose_type_ext: Option<FieldExtension>,
    /** **[ResearchStudyPhase](http://hl7.org/fhir/ValueSet/research-study-phase); n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4**

 The stage in the progression of a therapy from initial experimental use in humans in clinical trials to post-market evaluation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "phase")]
    pub phase: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_phase")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub phase_ext: Option<FieldExtension>,
    /** **[StudyDesign](http://hl7.org/fhir/ValueSet/study-design); Classifications of the study design characteristics**

 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 = "studyDesign")]
    pub study_design: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_studyDesign")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub study_design_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyFocusType](http://hl7.org/fhir/ValueSet/research-study-focus-type); Drugs, devices, etc. under study**

 The 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<CodeableReference>>,
    /// 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>>,
    /** **[ConditionCode](http://hl7.org/fhir/ValueSet/condition-code); Condition being studied**

 The condition that is the focus of the study.  For example, In a study to examine risk factors for Lupus, might have as an inclusion criterion "healthy volunteer", but the target condition code would be a Lupus SNOMED code.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[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 area for the study**

 A country, state or other area where the study is taking place rather than its precise geographic location or address.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "region")]
    pub region: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_region")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub region_ext: Vec<Option<FieldExtension>>,
    /** **Brief text explaining the study**

 A brief text for explaining the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "descriptionSummary")]
    pub description_summary: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_descriptionSummary")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_summary_ext: Option<FieldExtension>,
    /** **Detailed narrative of the study**

 A detailed and human-readable narrative of the study. E.g., study abstract.

 */
    #[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>,
    /** **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>,
    /** **Facility where study activities are conducted**

 A facility in which study activities are conducted.

 */
    #[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>>,
    /** **Comments made about the study**

 Comments made about the study 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>>,
    /** **[ResearchStudyClassifiers](http://hl7.org/fhir/ValueSet/research-study-classifiers); Classification for the study**

 Additional grouping mechanism or categorization of a research study. Example: FDA regulated device, FDA regulated drug, MPG Paragraph 23b (a German legal requirement), IRB-exempt, etc. Implementation Note: do not use the classifier element to support existing semantics that are already supported thru explicit elements in the resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **Sponsors, collaborators, and other parties**

 Sponsors, collaborators, and other parties.

 For a Sponsor or a PrincipalInvestigator use the dedicated attributes provided. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "associatedParty")]
    pub associated_party: Vec<Option<ResearchStudyAssociatedParty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_associatedParty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub associated_party_ext: Vec<Option<FieldExtension>>,
    /** **Status of study with time for that status**

 Status of study with time for that status.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "progressStatus")]
    pub progress_status: Vec<Option<ResearchStudyProgressStatus>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_progressStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub progress_status_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyReasonStopped](http://hl7.org/fhir/ValueSet/research-study-reason-stopped); accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of-study-progress | temporarily-closed-per-study-design**

 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 = "whyStopped")]
    pub why_stopped: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_whyStopped")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub why_stopped_ext: Option<FieldExtension>,
    /** **Target or actual group of participants enrolled in study**

 Target or actual group of participants enrolled in study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recruitment")]
    pub recruitment: Option<ResearchStudyRecruitment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recruitment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recruitment_ext: Option<FieldExtension>,
    /** **Defined path through the study for a subject**

 Describes an expected event or sequence of events for one of the subjects of a study. E.g. for a living subject: exposure to drug A, wash-out, exposure to drug B, wash-out, follow-up. E.g. for a stability study: {store sample from lot A at 25 degrees for 1 month}, {store sample from lot A at 40 degrees for 1 month}.

 In many clinical trials this is refered to as the ARM of the study, but such a term is not used in other sorts of trials even when there is a comparison between two or more groups. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comparisonGroup")]
    pub comparison_group: Vec<Option<ResearchStudyComparisonGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_comparisonGroup")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub comparison_group_ext: Vec<Option<FieldExtension>>,
    /** **A goal for the study**

 A goal that the study is aiming to achieve in terms of a scientific question to be answered by the analysis of data collected during the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "objective")]
    pub objective: Vec<Option<ResearchStudyObjective>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_objective")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub objective_ext: Vec<Option<FieldExtension>>,
    /** **A variable measured during the study**

 An "outcome measure", "endpoint", "effect measure" or "measure of effect" is a specific measurement or observation used to quantify the effect of experimental variables on the participants in a study, or for observational studies, to describe patterns of diseases or traits or associations with exposures, risk factors or treatment.

 A study may have multiple distinct outcome measures that can be used to assess the overall goal for a study. The goal of a study is in the objective whereas the metric by which the goal is assessed is the outcomeMeasure. Examples: Time to Local Recurrence (TLR), Disease-free Survival (DFS), 30 Day Mortality, Systolic BP */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeMeasure")]
    pub outcome_measure: Vec<Option<ResearchStudyOutcomeMeasure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcomeMeasure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_measure_ext: Vec<Option<FieldExtension>>,
    /** **Link to results generated during the study**

 Link to one or more sets of results generated by the study.  Could also link to a research registry holding the results such as ClinicalTrials.gov.

 */
    #[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>>,
}
#[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 label 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 = "ResearchStudyLabelBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyLabel {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TitleType](http://hl7.org/fhir/ValueSet/title-type); primary | official | scientific | plain-language | subtitle | short-title | acronym | earlier-title | language | auto-translated | human-use | machine-use | duplicate-uid**

 Kind of name.

 */
    #[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 name**

 The name.

 */
    #[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 ResearchStudyLabel {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyLabelBuilder {
        ResearchStudyLabelBuilder::default()
    }
}
/// Sub-fields of the associatedParty 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 = "ResearchStudyAssociatedPartyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyAssociatedParty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 associated party**

 Name of associated party.

 */
    #[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>,
    /** **[ResearchStudyPartyRole](http://hl7.org/fhir/ValueSet/research-study-party-role); sponsor | lead-sponsor | sponsor-investigator | primary-investigator | collaborator | funding-source | general-contact | recruitment-contact | sub-investigator | study-director | study-chair**

 Type of association.

 */
    #[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>,
    /** **When active in the role**

 Identifies the start date and the end date of the associated party in the role.

 The cardinality is 0..* due to the fact that an associated party may be intermittently active in a given role over multiple time periods. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub period_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyPartyOrganizationType](http://hl7.org/fhir/ValueSet/research-study-party-organization-type); nih | fda | government | nonprofit | academic | industry**

 A categorization other than role for the associated party.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classifier")]
    pub classifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classifier_ext: Vec<Option<FieldExtension>>,
    /** **Individual or organization associated with study (use practitionerRole to specify their organisation)**

 Individual or organization associated with study (use practitionerRole to specify their organisation).

 Suggestions of a better attribute name are appreciated */
    #[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 ResearchStudyAssociatedParty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyAssociatedPartyBuilder {
        ResearchStudyAssociatedPartyBuilder::default()
    }
}
/// Sub-fields of the progressStatus 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 = "ResearchStudyProgressStatusBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyProgressStatus {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResearchStudyStudyStatus](http://hl7.org/fhir/ValueSet/research-study-status); Label for status or state (e.g. recruitment status)**

 Label for status or state (e.g. recruitment status).

 */
    #[serde(rename = "state")]
    pub state: CodeableConcept,
    /// 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>,
    /** **Actual if true else anticipated**

 An indication of whether or not the date is a known date when the state changed or will change. A value of true indicates a known date. A value of false indicates an estimated date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actual")]
    pub actual: Option<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>,
    /** **Date range**

 Date range.

 */
    #[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 ResearchStudyProgressStatus {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyProgressStatusBuilder {
        ResearchStudyProgressStatusBuilder::default()
    }
}
/// Sub-fields of the recruitment 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 = "ResearchStudyRecruitmentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyRecruitment {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Estimated total number of participants to be enrolled**

 Estimated total number of participants to be enrolled.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetNumber")]
    pub target_number: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_targetNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_number_ext: Option<FieldExtension>,
    /** **Actual total number of participants enrolled in study**

 Actual total number of participants enrolled in study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actualNumber")]
    pub actual_number: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_number_ext: Option<FieldExtension>,
    /** **Inclusion and exclusion criteria**

 Inclusion and exclusion criteria.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eligibility")]
    pub eligibility: Option<Reference>,
    /// 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>,
    /** **Group of participants who were enrolled in study**

 Group of participants who were enrolled in study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actualGroup")]
    pub actual_group: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_group_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ResearchStudyRecruitment {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyRecruitmentBuilder {
        ResearchStudyRecruitmentBuilder::default()
    }
}
/// Sub-fields of the comparisonGroup 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 = "ResearchStudyComparisonGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyComparisonGroup {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily**

 Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkId")]
    pub link_id: Option<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>,
    /** **Label for study comparisonGroup**

 Unique, human-readable label for this comparisonGroup 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>,
    /** **[ResearchStudyArmType](http://hl7.org/fhir/ValueSet/research-study-arm-type); Categorization of study comparisonGroup**

 Categorization of study comparisonGroup, 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 = "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>,
    /** **Short explanation of study path**

 A succinct description of the path through the study that would be followed by a subject adhering to this comparisonGroup.

 */
    #[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>,
    /** **Interventions or exposures in this comparisonGroup or cohort**

 Interventions or exposures in this comparisonGroup or cohort.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intendedExposure")]
    pub intended_exposure: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_intendedExposure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub intended_exposure_ext: Vec<Option<FieldExtension>>,
    /** **Group of participants who were enrolled in study comparisonGroup**

 Group of participants who were enrolled in study comparisonGroup.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observedGroup")]
    pub observed_group: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observedGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observed_group_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ResearchStudyComparisonGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyComparisonGroupBuilder {
        ResearchStudyComparisonGroupBuilder::default()
    }
}
/// Sub-fields of the objective 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 = "ResearchStudyObjectiveBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyObjective {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the objective**

 Unique, human-readable label for this objective of the study.

 */
    #[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>,
    /** **[ResearchStudyObjectiveType](http://hl7.org/fhir/ValueSet/research-study-objective-type); primary | secondary | exploratory**

 The kind of study objective.

 */
    #[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>,
    /** **Description of the objective**

 Free text description of the objective of the study.  This is what the study is trying to achieve rather than how it is going to achieve it (see ResearchStudy.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>,
}
#[cfg(feature = "builders")]
impl ResearchStudyObjective {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyObjectiveBuilder {
        ResearchStudyObjectiveBuilder::default()
    }
}
/// Sub-fields of the outcomeMeasure 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 = "ResearchStudyOutcomeMeasureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyOutcomeMeasure {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the outcome**

 Label for the outcome.

 */
    #[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>,
    /** **[ResearchStudyObjectiveType](http://hl7.org/fhir/ValueSet/research-study-objective-type); primary | secondary | exploratory**

 The parameter or characteristic being assessed as one of the values by which the study is assessed.

 */
    #[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>>,
    /** **Description of the outcome**

 Description of the outcome.

 */
    #[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>,
    /** **Structured outcome definition**

 Structured outcome definition.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl ResearchStudyOutcomeMeasure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyOutcomeMeasureBuilder {
        ResearchStudyOutcomeMeasureBuilder::default()
    }
}
/** A ResearchSubject is a participant or object which is the recipient of investigative activities in a research study.

 **[ResearchSubject](http://hl7.org/fhir/StructureDefinition/ResearchSubject) v5.0.0**

 Participant or object which is the recipient of investigative activities in a study

 A ResearchSubject is a participant or object which is the recipient of investigative activities in a research study.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ResearchSubject(pub Box<ResearchSubjectInner>);
/** A ResearchSubject is a participant or object which is the recipient of investigative activities in a research study.

 **[ResearchSubject](http://hl7.org/fhir/StructureDefinition/ResearchSubject) v5.0.0**

 Participant or object which is the recipient of investigative activities in a study

 A ResearchSubject is a participant or object which is the recipient of investigative activities in a research study.

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 in a study**

 Identifiers assigned to this research subject for a 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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The publication state of the resource (not of the subject).

 */
    #[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>,
    /** **Subject status**

 The current state (status) of the subject and resons for status change where appropriate.

 This is intended to deal with the confusion routinely created by haing two conflated concepts of being in a particular state and having achieved a particular milestone.  In strict terms a milestone is a point of time event that results in a change from one state to another.  The state before the milestone is achieved is often given the same name as the milestone, and sometimes the state may have the same description.  For instance "Randomised" and "Visit 1" may be different milestones but the state remains at "on study" after each of them.

It is likely that more than one "state" pattern will be recorded for a subject and a type has been introduced to allow this simultaneous recording. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "progress")]
    pub progress: Vec<Option<ResearchSubjectProgress>>,
    /// 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>>,
    /** **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 or what is part of study**

 The record of the person, animal or other entity involved in the study.

 */
    #[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>,
    /** **What path should be followed**

 The name of the arm in the study the subject is expected to follow as part of this study.

 Maybe this is really PlanDefinition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assignedComparisonGroup")]
    pub assigned_comparison_group: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assignedComparisonGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assigned_comparison_group_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 = "actualComparisonGroup")]
    pub actual_comparison_group: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualComparisonGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_comparison_group_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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "consent")]
    pub consent: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_consent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub consent_ext: Vec<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
    }
}
/// Sub-fields of the progress field in ResearchSubject
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ResearchSubjectProgressBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchSubjectProgress {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResearchSubjectStateType](http://hl7.org/fhir/ValueSet/research-subject-state-type); state | milestone**

 Identifies the aspect of the subject's journey that the state refers to.

 */
    #[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>,
    /** **[ResearchSubjectProgresss](http://hl7.org/fhir/ValueSet/research-subject-state); candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn**

 The current state of the subject.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectState")]
    pub subject_state: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subjectState")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_state_ext: Option<FieldExtension>,
    /** **[ResearchSubjectMilestone](http://hl7.org/fhir/ValueSet/research-subject-milestone); SignedUp | Screened | Randomized**

 The milestones the subject has passed through.

 There can be multiple entries but it is also valid to just have the most recent.  This should npt be rlied upon as the full path the subject has taken. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "milestone")]
    pub milestone: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_milestone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub milestone_ext: Option<FieldExtension>,
    /** **[StateChangeReason](http://terminology.hl7.org/ValueSet/state-change-reason); State change reason**

 The reason for the state change.  If coded it should follow the formal subject state model.

 */
    #[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>,
    /** **State change date**

 The date when the new status started.

 This is NOT the date the change in state was recorded. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "startDate")]
    pub start_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_startDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_date_ext: Option<FieldExtension>,
    /** **State change date**

 The date when the state ended.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endDate")]
    pub end_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_date_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ResearchSubjectProgress {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchSubjectProgressBuilder {
        ResearchSubjectProgressBuilder::default()
    }
}
/** An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.

 **[RiskAssessment](http://hl7.org/fhir/StructureDefinition/RiskAssessment) v5.0.0**

 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>);
/** An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.

 **[RiskAssessment](http://hl7.org/fhir/StructureDefinition/RiskAssessment) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 = "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>>,
    /** **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(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>,
    /** **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 = "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 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, patient, related person, 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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Information used in assessment**

 Indicates the source data considered as part of the assessment (for example, 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 = "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 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),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(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>,
    /** **Likelihood of specified outcome**

 Indicates how likely the outcome is (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**

 Indicates how likely the outcome is (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, or 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),
}
/** A container for slots of time that may be available for booking appointments.

 **[Schedule](http://hl7.org/fhir/StructureDefinition/Schedule) v5.0.0**

 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>);
/** A container for slots of time that may be available for booking appointments.

 **[Schedule](http://hl7.org/fhir/StructureDefinition/Schedule) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); High-level category**

 A broad categorization of the 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 = "serviceCategory")]
    pub service_category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_category_ext: Vec<Option<FieldExtension>>,
    /** **[service-type](http://hl7.org/fhir/ValueSet/service-type); Specific service**

 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<CodeableReference>>,
    /// 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); Type of specialty needed**

 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>>,
    /** **Human-readable label**

 Further description of the schedule as it would be presented to a consumer while searching.

 This MAY be used to describe what the schedule is for where it is clearer than just the name of the single actor. */
    #[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>,
    /** **Resource(s) that availability information is being provided for**

 Slots that reference this schedule resource provide the availability details to these referenced resource(s).

 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 practitioner 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>>,
    /** **Period of time covered by schedule**

 The period of time that the slots that reference 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 availability**

 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
    }
}
/** A search parameter that defines a named search item that can be used to search/filter on a resource.

 **[SearchParameter](http://hl7.org/fhir/StructureDefinition/SearchParameter) v5.0.0**

 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>);
/** A search parameter that defines a named search item that can be used to search/filter on a resource.

 **[SearchParameter](http://hl7.org/fhir/StructureDefinition/SearchParameter) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this search parameter, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this search parameter is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the search parameter is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 search parameter (business identifier)**

 A formal identifier that is used to identify this search parameter when it is represented in other formats, or referenced in a specification, model, design or an 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>>,
    /** **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 reference to a particular business version of the search parameter with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<SearchParameterVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<SearchParameterVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 search parameter (human friendly)**

 A short, descriptive, user-friendly title for the search parameter.

 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>,
    /** **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>,
    /** **[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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 parameters that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the search parameter was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual tresponsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 search parameter**

 And how it used.

 This description can be used to capture details such as 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 search parameter is presumed to be the predominant language in the place the search parameter 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate search parameter instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the search parameter and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the search parameter.

 ... */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **Recommended name for parameter in search url**

 The label that is recommended to be used in the URL or the parameter name in a parameters resource for this search parameter.  In some cases, servers may need to use a different CapabilityStatement searchParam.name to differentiate between multiple SearchParameters that happen to have the same code.

 For maximum compatibility, use only lowercase ASCII characters. Note that HL7 will never define multiple search parameters with the same 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/version-independent-all-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 apply to at least one resource type. When search parameters apply to more than one resource type, 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::FHIRTypes>>,
    /// 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 | special**

 The type of value that a search parameter may contain, 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>,
    /** **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>,
    /** **[SearchProcessingModeType](http://hl7.org/fhir/ValueSet/search-processingmode); normal | phonetic | other**

 How the search parameter relates to the set of elements returned by evaluating the expression query.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processingMode")]
    pub processing_mode: Option<codes::SearchProcessingModeType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_processingMode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub processing_mode_ext: Option<FieldExtension>,
    /** **FHIRPath expression that constraints the usage of this SearchParamete**

 FHIRPath expression that defines/sets a complex constraint for when this SearchParameter is applicable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "constraint")]
    pub constraint: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_constraint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub constraint_ext: Option<FieldExtension>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/version-independent-all-resource-types); Types of resource (if a resource reference)**

 Types of resource (if a resource is referenced).

 In some cases, targets may exist for a search parameter that do not exist for the specified FHIRPath for all of the resources identified in SearchParameter.base.  For example, the core clinical-encounter search parameter allows both Encounter and EpisodeOfCare as targets, even though not all of the base resources have EpisodeOfCare as a valid target.

However, the list of targets SHOULD cover all targets that might appear that are permitted by the specified FHIRPath. */
    #[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::FHIRTypes>>,
    /// 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>>,
    /** **Allow multiple values per parameter (or)**

 Whether multiple values are allowed for each time the parameter exists. Values are separated by commas, and the parameter matches if any of the values match.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "multipleOr")]
    pub multiple_or: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_multipleOr")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub multiple_or_ext: Option<FieldExtension>,
    /** **Allow multiple parameters (and)**

 Whether multiple parameters are allowed - e.g. more than one parameter with the same name. The search matches if all the parameters match.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "multipleAnd")]
    pub multiple_and: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_multipleAnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub multiple_and_ext: 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 | identifier | of-type | code-text | text-advanced | iterate**

 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.

 Notes:

* Not all systems will declare chain values.  If no chain values are specified at all, then no presumptions can be made about the degree of chaining support available
* A server may use a single chain value of '*' to mean that all reference search types supported can be chained rather than enumerating all chain values
*  If a particular reference search parameter is supported, but not subsequent chaining, then just list that search parameter name - e.g. for Patient.practitioner, the chain value would be ```textpractitioner```
* If a particular reference search parameter is supported with unlimited chaining beneath it, then follow the search parameter name with '.'.  E.g. ```textpractitioner.```
* If there are specific (not unlimited) chaining paths allowed they can be explicitly enumerated.  E.g. ```textpractitioner.organization``` */
    #[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
    }
}
/// Choice of types for the versionAlgorithm[x] field in SearchParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SearchParameterVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for SearchParameterVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SearchParameterVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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: 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>,
    /** **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()
    }
}
/** A record of a request for service such as diagnostic investigations, treatments, or operations to be performed.

 **[ServiceRequest](http://hl7.org/fhir/StructureDefinition/ServiceRequest) v5.0.0**

 A request for a service to be performed

 A record of a request for service such as diagnostic investigations, treatments, or operations to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ServiceRequest(pub Box<ServiceRequestInner>);
/** A record of a request for service such as diagnostic investigations, treatments, or operations to be performed.

 **[ServiceRequest](http://hl7.org/fhir/StructureDefinition/ServiceRequest) v5.0.0**

 A request for a service to be performed

 A record of a request for service such as 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 = "ServiceRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ServiceRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ServiceRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ServiceRequest", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>>,
    /** **Instantiates FHIR protocol or definition**

 The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this ServiceRequest.

 The PlanDefinition resource is used to describe series, sequences, or groups of actions to be taken, while the ActivityDefinition resource is used to define each specific step or activity to be performed. More information can be found in the [Boundaries and Relationships](plandefinition.html#12.23.2) section for PlanDefinition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates external protocol or definition**

 The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this ServiceRequest.

 This might be an HTML page, PDF, etc. or could just be a non-resolvable URI identifier. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_uri_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 service 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>,
    /** **[ServiceRequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | on-hold | revoked | completed | entered-in-error | unknown**

 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, revoked or placed on-hold. 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. */
    #[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>,
    /** **[ServiceRequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | directive | 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>,
    /** **[ServiceRequestCategory](http://hl7.org/fhir/ValueSet/servicerequest-category); Classification of service**

 A code that classifies the service 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>>,
    /** **[ServiceRequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the ServiceRequest 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 service/procedure should not be performed**

 Set this to true if the record is saying that the service/procedure should NOT be performed.

 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 ServiceRequest.code and ServiceRequest.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>,
    /** **[ServiceRequestCode](http://hl7.org/fhir/ValueSet/procedure-code); What is being requested/ordered**

 A code or reference that identifies a particular service (i.e., 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 order name, for example,  serum or serum/plasma glucose, or a chest x-ray. The specimen might not be recorded separately from the test code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableReference>,
    /// 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 order information**

 Additional details and instructions about the how the services are to be delivered.   For example, and order for a urinary catheter may have an order detail for an external or indwelling catheter, or an order for a bandage may require additional instructions specifying how the bandage should be applied.

 For information from the medical record intended to support the delivery of the requested services, use the `supportingInformation` element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orderDetail")]
    pub order_detail: Vec<Option<ServiceRequestOrderDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_orderDetail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub order_detail_ext: Vec<Option<FieldExtension>>,
    /** **Service amount**

 An amount of service being requested which can be a quantity ( for example $1,500 home modification), a ratio ( for example, 20 half day visits per month), or a range (2.0 to 1.8 Gy per fraction).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub quantity: Option<ServiceRequestQuantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<ServiceRequestQuantityExtension>,
    /** **Individual or Entity the service is ordered for**

 On whom or what the service 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>,
    /** **What the service request is about, when it is not about the subject of record**

 The actual focus of a service request when it is not the subject of record representing something or someone associated with the subject such as a spouse, parent, fetus, or donor. The focus of a service request could also be an existing condition,  an intervention, the subject's diet,  another service request on the subject,  or a body structure such as tumor or implanted device.

 */
    #[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>>,
    /** **Encounter in which the request was created**

 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>,
    /** **When service should occur**

 The date/time at which the requested service should occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ServiceRequestOccurrence>,
    /// 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<ServiceRequestOccurrenceExtension>,
    /** **Preconditions for service**

 If a CodeableConcept is present, it indicates the pre-condition for performing the service.  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<ServiceRequestAsNeeded>,
    /// 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<ServiceRequestAsNeededExtension>,
    /** **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 service**

 The individual who initiated the request and has responsibility for its activation.

 This not the dispatcher, but rather who is the authorizer.  This element is not intended to handle delegation which would generally be managed through the Provenance resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<Reference>,
    /// 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>,
    /** **[ServiceRequestParticipantRole](http://hl7.org/fhir/ValueSet/participant-role); Performer role**

 Desired type of performer for doing the requested service.

 This is a  role, not  a participation type.  In other words, does not describe the task but describes the capacity.  For example, “compounding pharmacy”, “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 performer**

 The desired performer for doing the requested service.  For example, the surgeon, dermatopathologist, endoscopist, etc.

 If multiple performers are present, it is interpreted as a list of *alternative* performers without any preference regardless of order.  If order of preference is needed use the [http://hl7.org/fhir/StructureDefinition/request-performerOrder](http://hl7.org/fhir/extensions/StructureDefinition-request-performerOrder.html).  Use CareTeam to represent a group of performers (for example, Practitioner A *and* Practitioner B). */
    #[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>>,
    /** **[ServiceRequestLocation](http://terminology.hl7.org/ValueSet/v3-ServiceDeliveryLocationRoleType); Requested location**

 The preferred location(s) where the procedure should actually happen in coded or free text form. E.g. at home or nursing day care center.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **[ServiceRequestReason](http://hl7.org/fhir/ValueSet/procedure-reason); Explanation/Justification for procedure or service**

 An explanation or justification for why this service is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in `supportingInfo`.

 This element represents why the referral is being made and may be used to decide how the service will be performed, or even if it will be performed at all. To be as specific as possible,  a reference to  *Observation* or *Condition* should be used if available.  Otherwise, use `concept.text` element if the data is free (uncoded) text as shown in the [CT Scan example](servicerequest-example-di.html). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Associated insurance coverage**

 Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be needed for delivering the requested service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<Reference>>,
    /// 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>>,
    /** **Additional clinical information**

 Additional clinical information about the patient or specimen that may influence the services 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.

 To represent information about how the services are to be delivered use the `instructions` element. */
    #[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<CodeableReference>>,
    /// 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.

 The purpose of the ServiceRequest.specimen is to reflect the actual specimen that the requested test/procedure is asked to be performed on, whether the lab already has it or not.  References to specimens for purposes other than to perform a test/procedure on should be made using the ServiceRequest.supportingInfo or the Specimen.parent where the Specimen.parent would enable descendency and ServiceRequest.supportingInfo a general reference for context. */
    #[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); Coded 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 ServiceRequest.code.  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 [http://hl7.org/fhir/StructureDefinition/procedure-targetBodyStructure](http://hl7.org/fhir/extensions/StructureDefinition-procedure-targetBodyStructure.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>>,
    /** **BodyStructure-based location on the body**

 Anatomic location where the procedure should be performed. This is the target site.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodyStructure")]
    pub body_structure: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodyStructure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_structure_ext: Option<FieldExtension>,
    /** **Comments**

 Any other notes and comments made about the service request. For example, internal billing 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>>,
    /** **Patient or consumer-oriented instructions**

 Instructions in terms that are understood by the patient or consumer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientInstruction")]
    pub patient_instruction: Vec<Option<ServiceRequestPatientInstruction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_patientInstruction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub patient_instruction_ext: Vec<Option<FieldExtension>>,
    /** **Request provenance**

 Key events in the history of the request.

 This might 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 ServiceRequestBuilder {
    #[doc = concat!("Finalize building ", "ServiceRequest", ".")]
    pub fn build(self) -> Result<ServiceRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ServiceRequestInner> for ServiceRequest {
    fn from(inner: ServiceRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ServiceRequest {
    type Target = ServiceRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ServiceRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ServiceRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ServiceRequestBuilder {
        ServiceRequestBuilder::default()
    }
}
impl ServiceRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ServiceRequest
    }
}
/// Sub-fields of the orderDetail field in ServiceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ServiceRequestOrderDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ServiceRequestOrderDetail {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 context of the order details by reference**

 Indicates the context of the order details by reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameterFocus")]
    pub parameter_focus: Option<CodeableReference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_parameterFocus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub parameter_focus_ext: Option<FieldExtension>,
    /** **The parameter details for the service being requested**

 The parameter details for the service being requested.

 */
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<ServiceRequestOrderDetailParameter>>,
    /// 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 ServiceRequestOrderDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ServiceRequestOrderDetailBuilder {
        ServiceRequestOrderDetailBuilder::default()
    }
}
/// Sub-fields of the parameter field in ServiceRequestOrderDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ServiceRequestOrderDetailParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ServiceRequestOrderDetailParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ServiceRequestOrderDetailParameterCode](http://hl7.org/fhir/ValueSet/servicerequest-orderdetail-parameter-code); The detail of the order being requested**

 A value representing the additional detail or instructions for the order (e.g., catheter insertion, body elevation, descriptive device configuration and/or setting instructions).

 */
    #[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 value for the order detail**

 Indicates a value for the order detail.

 CodeableConcept values are indented to express concepts that would normally be coded - when a code is not available for a concept, CodeableConcept.text can be used. When the data is a text or not a single identifiable concept, string should be used. */
    #[serde(flatten)]
    pub value: ServiceRequestOrderDetailParameterValue,
    /// 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<ServiceRequestOrderDetailParameterValueExtension>,
}
#[cfg(feature = "builders")]
impl ServiceRequestOrderDetailParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ServiceRequestOrderDetailParameterBuilder {
        ServiceRequestOrderDetailParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in ServiceRequestOrderDetailParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestOrderDetailParameterValue {
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
}
/// Extension value for ServiceRequestOrderDetailParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestOrderDetailParameterValueExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
}
/// Choice of types for the quantity[x] field in ServiceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestQuantity {
    /// Variant accepting the Quantity type.
    #[serde(rename = "quantityQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Ratio type.
    #[serde(rename = "quantityRatio")]
    Ratio(Ratio),
    /// Variant accepting the Range type.
    #[serde(rename = "quantityRange")]
    Range(Range),
}
/// Extension value for ServiceRequestQuantity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestQuantityExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_quantityQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_quantityRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_quantityRange")]
    Range(FieldExtension),
}
/// Choice of types for the occurrence[x] field in ServiceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestOccurrence {
    /// 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 ServiceRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestOccurrenceExtension {
    /// 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 ServiceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestAsNeeded {
    /// Variant accepting the Boolean type.
    #[serde(rename = "asNeededBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "asNeededCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for ServiceRequestAsNeeded.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestAsNeededExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_asNeededBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_asNeededCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the patientInstruction field in ServiceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ServiceRequestPatientInstructionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ServiceRequestPatientInstruction {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Patient or consumer-oriented instructions**

 Instructions in terms that are understood by the patient or consumer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub instruction: Option<ServiceRequestPatientInstructionInstruction>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instruction_ext: Option<ServiceRequestPatientInstructionInstructionExtension>,
}
#[cfg(feature = "builders")]
impl ServiceRequestPatientInstruction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ServiceRequestPatientInstructionBuilder {
        ServiceRequestPatientInstructionBuilder::default()
    }
}
/// Choice of types for the instruction[x] field in ServiceRequestPatientInstruction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestPatientInstructionInstruction {
    /// Variant accepting the Markdown type.
    #[serde(rename = "instructionMarkdown")]
    Markdown(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "instructionReference")]
    Reference(Reference),
}
/// Extension value for ServiceRequestPatientInstructionInstruction.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ServiceRequestPatientInstructionInstructionExtension {
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_instructionMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_instructionReference")]
    Reference(FieldExtension),
}
/** A slot of time on a schedule that may be available for booking appointments.

 **[Slot](http://hl7.org/fhir/StructureDefinition/Slot) v5.0.0**

 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>);
/** A slot of time on a schedule that may be available for booking appointments.

 **[Slot](http://hl7.org/fhir/StructureDefinition/Slot) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 categorization of the service that is to be performed during this appointment**

 A broad categorization of the 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 = "serviceCategory")]
    pub service_category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_category_ext: Vec<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 Schedule 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 Schedule 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<CodeableReference>>,
    /// 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://terminology.hl7.org/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).

 A slot may be allow multiple appointment types, but when booked, would only be used for one of the given appointment types. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointmentType")]
    pub appointment_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_appointmentType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub appointment_type_ext: Vec<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
    }
}
/** A sample to be used for analysis.

 **[Specimen](http://hl7.org/fhir/StructureDefinition/Specimen) v5.0.0**

 Sample for analysis

 A sample to be used for analysis.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Specimen(pub Box<SpecimenInner>);
/** A sample to be used for analysis.

 **[Specimen](http://hl7.org/fhir/StructureDefinition/Specimen) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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://terminology.hl7.org/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 patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device**

 Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.

 */
    #[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 time when specimen is received by the testing laboratory**

 Time when specimen is received by the testing laboratory 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 service request that required a specimen to be collected.

 The request may be explicit or implied such with a ServiceRequest 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>>,
    /** **[SpecimenCombined](http://hl7.org/fhir/ValueSet/specimen-combined); grouped | pooled**

 This element signifies if the specimen is part of a group or pooled.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "combined")]
    pub combined: Option<codes::SpecimenCombined>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_combined")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub combined_ext: Option<FieldExtension>,
    /** **[SpecimenRole](http://hl7.org/fhir/ValueSet/specimen-role); The role the specimen serves**

 The role or reason for the specimen in the testing workflow.

 */
    #[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>>,
    /** **The physical feature of a specimen**

 A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "feature")]
    pub feature: Vec<Option<SpecimenFeature>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_feature")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub feature_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>>,
    /** **[SpecimenCondition](http://terminology.hl7.org/ValueSet/v2-0493); State of the specimen**

 A mode or state of being that describes the nature of the specimen.

 Specimen condition is an observation made about the specimen.  It's a point-in-time assessment.  It can be used to assess its quality or appropriateness for a specific test. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **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 feature 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 = "SpecimenFeatureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenFeature {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SpecimenFeatureType](http://hl7.org/fhir/ValueSet/body-site); Highlighted feature**

 The landmark or feature being highlighted.

 */
    #[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>,
    /** **Information about the feature**

 Description of the feature of the specimen.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl SpecimenFeature {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenFeatureBuilder {
        SpecimenFeatureBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **How long it took to collect specimen**

 The span of time over which the collection of a specimen occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "duration")]
    pub duration: Option<Duration>,
    /// 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>,
    /** **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>,
    /** **[SpecimenCollectionDevice](); Device 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 = "device")]
    pub device: Option<CodeableReference>,
    /// 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>,
    /** **The procedure that collects the specimen**

 The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Option<Reference>,
    /// 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>,
    /** **[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.

 Reasons for using BodyStructure reference include: 1.) Need to identify a specific site instance (e.g. a specific mole), 2.) a single pre-coordinated coded concept for the body site does not exist, 3.) a desire to represent bodySite using multiple attributes (e.g. modifiers). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableReference>,
    /// 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>,
    /** **Whether or how long patient abstained from food and/or drink**

 Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.

 Representing fasting status using this element is preferred to representing it with an observation using a 'pre-coordinated code'  such as  LOINC 2005-7 (Calcium [Moles/​time] in 2 hour Urine --12 hours fasting), or  using  a component observation ` such as `Observation.component code`  = LOINC 49541-6 (Fasting status - Reported). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub fasting_status: Option<SpecimenCollectionFastingStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fasting_status_ext: Option<SpecimenCollectionFastingStatusExtension>,
}
#[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),
}
/// Choice of types for the fastingStatus[x] field in SpecimenCollection
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenCollectionFastingStatus {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "fastingStatusCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Duration type.
    #[serde(rename = "fastingStatusDuration")]
    Duration(Duration),
}
/// Extension value for SpecimenCollectionFastingStatus.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenCollectionFastingStatusExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_fastingStatusCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_fastingStatusDuration")]
    Duration(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **[SpecimenProcessingMethod](http://hl7.org/fhir/ValueSet/specimen-processing-method); Indicates the treatment step  applied to the specimen**

 A coded value specifying the method used to process the specimen.

 */
    #[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>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Device resource for the container**

 The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.

 */
    #[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>,
    /** **Where the container is**

 The location of the container holding the specimen.

 */
    #[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>,
    /** **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>,
}
#[cfg(feature = "builders")]
impl SpecimenContainer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenContainerBuilder {
        SpecimenContainerBuilder::default()
    }
}
/** A kind of specimen with associated set of requirements.

 **[SpecimenDefinition](http://hl7.org/fhir/StructureDefinition/SpecimenDefinition) v5.0.0**

 Kind of specimen

 A kind of specimen with associated set of requirements.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SpecimenDefinition(pub Box<SpecimenDefinitionInner>);
/** A kind of specimen with associated set of requirements.

 **[SpecimenDefinition](http://hl7.org/fhir/StructureDefinition/SpecimenDefinition) v5.0.0**

 Kind of specimen

 A kind of specimen with associated set of requirements.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SpecimenDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SpecimenDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SpecimenDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 canonical URL to reference this SpecimenDefinition (globally unique)**

 An absolute URL that is used to identify this SpecimenDefinition 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 SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred. This is the URI that will be used when making canonical references to this resource. */
    #[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 identifier**

 A business identifier assigned to this SpecimenDefinition.

 */
    #[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 SpecimenDefinition**

 The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.

 There may be multiple different instances of a SpecimenDefinition that have the same identifier but different versions. */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<SpecimenDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<SpecimenDefinitionVersionAlgorithmExtension>,
    /** **Name for this {{title}} (computer friendly)**

 A natural language name identifying the {{title}}. 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 alphanumeric type name to ensure that it is machine-processing 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 SpecimenDefinition (Human friendly)**

 A short, descriptive, user-friendly title for the SpecimenDefinition.

 */
    #[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>,
    /** **Based on FHIR definition of another SpecimenDefinition**

 The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFromCanonical")]
    pub derived_from_canonical: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFromCanonical")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_canonical_ext: Vec<Option<FieldExtension>>,
    /** **Based on external definition**

 The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFromUri")]
    pub derived_from_uri: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFromUri")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_uri_ext: Vec<Option<FieldExtension>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The current state of theSpecimenDefinition.

 A nominal state-transition diagram can be found in the [Definition pattern](definition.html#statemachine) documentation
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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **If this SpecimenDefinition is not for real usage**

 A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.

 Allows filtering of SpecimenDefinition that are appropriate for use vs. not. */
    #[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>,
    /** **Type of subject for specimen collection**

 A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.

 Examples: person, animal, device, water …. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub subject: Option<SpecimenDefinitionSubject>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<SpecimenDefinitionSubjectExtension>,
    /** **Date status first applied**

 For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 name of the individual or organization that published the SpecimenDefinition**

 Helps establish the "authority/credibility" of the SpecimenDefinition. May also allow for contact.

 */
    #[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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 SpecimenDefinition**

 A free text natural language description of the SpecimenDefinition from the consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the module as conveyed in the text field of the resource itself. 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 = "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>,
    /** **Content intends to support these contexts**

 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 of specimen definitions.

 When multiple usageContexts are specified, there is no expectation for 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 this SpecimenDefinition (if applicable)**

 A jurisdiction in which the SpecimenDefinition is intended to be used.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 SpecimenDefinition is defined**

 Explains why this SpecimeDefinition is needed and why it has been designed as it has.

 This element does not describe the usage of the SpecimenDefinition. Rather it is for 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 SpecimenDefinition. */
    #[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**

 Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When SpecimenDefinition was approved by publisher**

 The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The date may be more recent than the approval date because of minor changes / editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **The date on which the asset content was last reviewed by the publisher**

 The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.

 If specified, this is usually after the approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **The effective date range for the SpecimenDefinition**

 The period during which the SpecimenDefinition content was or is planned to be effective.

 The effective period for a SpecimenDefinition determines when the content is applicable for usage and is independent of publication and review dates.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[CollectedSpecimenType](http://terminology.hl7.org/ValueSet/v2-0487); Kind of material to collect**

 The kind of material to be collected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeCollected")]
    pub type_collected: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeCollected")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_collected_ext: Option<FieldExtension>,
    /** **[PreparePatient](http://hl7.org/fhir/ValueSet/prepare-patient-prior-specimen-collection); Patient preparation for collection**

 Preparation of the patient for specimen collection.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patientPreparation")]
    pub patient_preparation: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_patientPreparation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub patient_preparation_ext: Vec<Option<FieldExtension>>,
    /** **Time aspect for collection**

 Time aspect of specimen collection (duration or offset).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timeAspect")]
    pub time_aspect: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_timeAspect")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub time_aspect_ext: Option<FieldExtension>,
    /** **[SpecimenCollection](http://hl7.org/fhir/ValueSet/specimen-collection); Specimen collection procedure**

 The action to be performed for collecting the specimen.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "collection")]
    pub collection: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_collection")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub collection_ext: Vec<Option<FieldExtension>>,
    /** **Specimen in container intended for testing by lab**

 Specimen conditioned in a container as expected by the testing laboratory.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeTested")]
    pub type_tested: Vec<Option<SpecimenDefinitionTypeTested>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_typeTested")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub type_tested_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SpecimenDefinitionBuilder {
    #[doc = concat!("Finalize building ", "SpecimenDefinition", ".")]
    pub fn build(self) -> Result<SpecimenDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SpecimenDefinitionInner> for SpecimenDefinition {
    fn from(inner: SpecimenDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SpecimenDefinition {
    type Target = SpecimenDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SpecimenDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SpecimenDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SpecimenDefinitionBuilder {
        SpecimenDefinitionBuilder::default()
    }
}
impl SpecimenDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SpecimenDefinition
    }
}
/// Choice of types for the versionAlgorithm[x] field in SpecimenDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for SpecimenDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the subject[x] field in SpecimenDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionSubject {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "subjectCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "subjectReference")]
    Reference(Reference),
}
/// Extension value for SpecimenDefinitionSubject.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionSubjectExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_subjectCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_subjectReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the typeTested field in SpecimenDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenDefinitionTypeTestedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenDefinitionTypeTested {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Primary or secondary specimen**

 Primary of secondary specimen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isDerived")]
    pub is_derived: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isDerived")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_derived_ext: Option<FieldExtension>,
    /** **[IntendedSpecimenType](http://terminology.hl7.org/ValueSet/v2-0487); Type of intended specimen**

 The kind of specimen conditioned for testing expected by lab.

 */
    #[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>,
    /** **[SpecimenContainedPreference](http://hl7.org/fhir/ValueSet/specimen-contained-preference); preferred | alternate**

 The preference for this type of conditioned specimen.

 */
    #[serde(rename = "preference")]
    pub preference: codes::SpecimenContainedPreference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preference_ext: Option<FieldExtension>,
    /** **The specimen's container**

 The specimen's container.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "container")]
    pub container: Option<SpecimenDefinitionTypeTestedContainer>,
    /// 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>,
    /** **Requirements for specimen delivery and special handling**

 Requirements for delivery and special handling of this kind of conditioned specimen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requirement_ext: Option<FieldExtension>,
    /** **The usual time for retaining this kind of specimen**

 The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "retentionTime")]
    pub retention_time: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_retentionTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub retention_time_ext: Option<FieldExtension>,
    /** **Specimen for single use only**

 Specimen can be used by only one test or panel if the value is "true".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "singleUse")]
    pub single_use: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_singleUse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub single_use_ext: Option<FieldExtension>,
    /** **[RejectionCriterion](http://hl7.org/fhir/ValueSet/rejection-criteria); Criterion specified for specimen rejection**

 Criterion for rejection of the specimen in its container by the laboratory.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rejectionCriterion")]
    pub rejection_criterion: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rejectionCriterion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rejection_criterion_ext: Vec<Option<FieldExtension>>,
    /** **Specimen handling before testing**

 Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "handling")]
    pub handling: Vec<Option<SpecimenDefinitionTypeTestedHandling>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_handling")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub handling_ext: Vec<Option<FieldExtension>>,
    /** **[TestingDestination](http://hl7.org/fhir/ValueSet/diagnostic-service-sections); Where the specimen will be tested**

 Where the specimen will be tested: e.g., lab, sector, device or any combination of these.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "testingDestination")]
    pub testing_destination: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_testingDestination")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub testing_destination_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SpecimenDefinitionTypeTested {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenDefinitionTypeTestedBuilder {
        SpecimenDefinitionTypeTestedBuilder::default()
    }
}
/// Sub-fields of the container field in SpecimenDefinitionTypeTested
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenDefinitionTypeTestedContainerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenDefinitionTypeTestedContainer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ContainerMaterial](http://hl7.org/fhir/ValueSet/container-material); The material type used for the container**

 The type of material of the container.

 Examples: glass, plastic, metal. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "material")]
    pub material: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_material")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub material_ext: Option<FieldExtension>,
    /** **[ContainerType](http://hl7.org/fhir/ValueSet/specimen-container-type); Kind of container associated with the kind of specimen**

 The type of container used to contain this kind of specimen.

 */
    #[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>,
    /** **[ContainerCap](http://hl7.org/fhir/ValueSet/container-cap); Color of container cap**

 Color of container cap.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cap")]
    pub cap: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cap")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cap_ext: Option<FieldExtension>,
    /** **The description of the kind of container**

 The textual description of the kind of 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>,
    /** **The capacity of this kind of container**

 The capacity (volume or other measure) of this kind of container.

 */
    #[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>,
    /** **Minimum volume**

 The minimum volume to be conditioned in the container.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub minimum_volume: Option<SpecimenDefinitionTypeTestedContainerMinimumVolume>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub minimum_volume_ext: Option<
        SpecimenDefinitionTypeTestedContainerMinimumVolumeExtension,
    >,
    /** **Additive associated with container**

 Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additive")]
    pub additive: Vec<Option<SpecimenDefinitionTypeTestedContainerAdditive>>,
    /// 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>>,
    /** **Special processing applied to the container for this specimen type**

 Special processing that should be applied to the container for this kind of specimen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preparation")]
    pub preparation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preparation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preparation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SpecimenDefinitionTypeTestedContainer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenDefinitionTypeTestedContainerBuilder {
        SpecimenDefinitionTypeTestedContainerBuilder::default()
    }
}
/// Choice of types for the minimumVolume[x] field in SpecimenDefinitionTypeTestedContainer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionTypeTestedContainerMinimumVolume {
    /// Variant accepting the Quantity type.
    #[serde(rename = "minimumVolumeQuantity")]
    Quantity(Quantity),
    /// Variant accepting the String type.
    #[serde(rename = "minimumVolumeString")]
    String(String),
}
/// Extension value for SpecimenDefinitionTypeTestedContainerMinimumVolume.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionTypeTestedContainerMinimumVolumeExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_minimumVolumeQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_minimumVolumeString")]
    String(FieldExtension),
}
/// Sub-fields of the additive field in SpecimenDefinitionTypeTestedContainer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenDefinitionTypeTestedContainerAdditiveBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenDefinitionTypeTestedContainerAdditive {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Additive associated with container**

 Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.

 */
    #[serde(flatten)]
    pub additive: SpecimenDefinitionTypeTestedContainerAdditiveAdditive,
    /// 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<
        SpecimenDefinitionTypeTestedContainerAdditiveAdditiveExtension,
    >,
}
#[cfg(feature = "builders")]
impl SpecimenDefinitionTypeTestedContainerAdditive {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenDefinitionTypeTestedContainerAdditiveBuilder {
        SpecimenDefinitionTypeTestedContainerAdditiveBuilder::default()
    }
}
/// Choice of types for the additive[x] field in SpecimenDefinitionTypeTestedContainerAdditive
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionTypeTestedContainerAdditiveAdditive {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "additiveCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "additiveReference")]
    Reference(Reference),
}
/// Extension value for SpecimenDefinitionTypeTestedContainerAdditiveAdditive.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenDefinitionTypeTestedContainerAdditiveAdditiveExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_additiveCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_additiveReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the handling field in SpecimenDefinitionTypeTested
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenDefinitionTypeTestedHandlingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenDefinitionTypeTestedHandling {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[HandlingConditionSet](http://hl7.org/fhir/ValueSet/handling-condition); Qualifies the interval of temperature**

 It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "temperatureQualifier")]
    pub temperature_qualifier: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_temperatureQualifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub temperature_qualifier_ext: Option<FieldExtension>,
    /** **Temperature range for these handling instructions**

 The temperature interval for this set of handling instructions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "temperatureRange")]
    pub temperature_range: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_temperatureRange")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub temperature_range_ext: Option<FieldExtension>,
    /** **Maximum preservation time**

 The maximum time interval of preservation of the specimen with these conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxDuration")]
    pub max_duration: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxDuration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_duration_ext: Option<FieldExtension>,
    /** **Preservation instruction**

 Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.

 */
    #[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 SpecimenDefinitionTypeTestedHandling {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenDefinitionTypeTestedHandlingBuilder {
        SpecimenDefinitionTypeTestedHandlingBuilder::default()
    }
}
/** 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.

 **[StructureDefinition](http://hl7.org/fhir/StructureDefinition/StructureDefinition) v5.0.0**

 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>);
/** 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.

 **[StructureDefinition](http://hl7.org/fhir/StructureDefinition/StructureDefinition) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this structure definition, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this structure definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure definition is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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. There is no expectation that versions can be placed in a lexicographical sequence, so authors are encouraged to populate the StructureDefinition.versionAlgorithm[x] element to enable comparisons. If there is no managed version available, authors can consider using ISO date/time syntax (e.g., '2023-01-01').

 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 reference to a particular business version of the structure definition with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<StructureDefinitionVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<StructureDefinitionVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing friendly.Some Examples:

* O2SatObservation
* PresentationReport
* Immunization2
* AcmeAdmissionRecordOld. */
    #[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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 definitions that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the structure definition was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 structure definition is presumed to be the predominant language in the place the structure definition 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate structure definition instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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.  The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element.

 ... */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **[StructureDefinitionKeyword](http://hl7.org/fhir/ValueSet/definition-use); Assist with indexing and finding**

 (DEPRECATED) A set of key words or terms from external terminologies that may be used to assist with indexing and searching of templates nby describing the use of this structure definition, or the content it describes.

 Note that this element is deprecated. Use the [http://hl7.org/fhir/StructureDefinition/artifact-topic](http://hl7.org/fhir/extensions/StructureDefinition-artifact-topic.html) extension instead. */
    #[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>>,
    /** **[FHIRVersion](http://hl7.org/fhir/ValueSet/FHIR-version); 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 4.6.0. 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<codes::FHIRVersion>,
    /// 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 StructureDefinition, but have children described, are anonymous concrete types that specialize 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>,
    /** **If an extension, where it can be used in instances**

 Identifies the types of resource or data type elements to which the extension can be applied. For more guidance on using the 'context' element, see the [defining extensions page](defining-extensions.html#context).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Vec<Option<StructureDefinitionContext>>,
    /// 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 FHIRPath Invariants about when the extension can be used (e.g. co-occurrence variants for the extension). All the rules must be true.

 The rules are only evaluated when the extension is present. When evaluating the invariant, the FHIRPath 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>>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/fhir-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).  References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models, where they are required.

 Note that in the case of constraints, the type could be determined by chasing through the baseDefinition references until a type defining 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.

The type must match the elements defined in the differential and the snapshot. For all FHIR defined types, the path name of the element will start with the type name. For logical models, where the type SHALL be a fully specified URL, the type name SHOULD start with the final path segment of the type URL where required. E.g. If the type was "http://example.org/fhir/MyLogicalModelType", the type name should start with 'MyLogicalModelType'. */
    #[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 "Base", "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 to the differential new elements and optionally additional rules to an existing concrete type, and the snapshot includes the inherited elements and rules.  If the definition is a constraint, then it cannot 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 standalone 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in StructureDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureDefinitionVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for StructureDefinitionVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureDefinitionVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 context 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 = "StructureDefinitionContextBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureDefinitionContext {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ExtensionContextType](http://hl7.org/fhir/ValueSet/extension-context-type); fhirpath | element | extension**

 Defines how to interpret the expression that defines what the context of the extension is.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ExtensionContextType,
    /// 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 extension can be used in instances**

 An expression that defines where an extension can be used in resources.

 */
    #[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 StructureDefinitionContext {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureDefinitionContextBuilder {
        StructureDefinitionContextBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** A Map of relationships between 2 structures that can be used to transform data.

 **[StructureMap](http://hl7.org/fhir/StructureDefinition/StructureMap) v5.0.0**

 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>);
/** A Map of relationships between 2 structures that can be used to transform data.

 **[StructureMap](http://hl7.org/fhir/StructureDefinition/StructureMap) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this structure map, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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, and can then 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 reference to a particular business version of the structure map with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<StructureMapVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<StructureMapVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 maps that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the structure map was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 structure map is presumed to be the predominant language in the place the structure map 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate structure map instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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 listing 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>>,
    /** **Definition of the constant value used in the map rules**

 Definition of a constant value used in the map rules.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "const")]
    pub r#const: Vec<Option<StructureMapConst>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_const")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#const_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
    }
}
/// Choice of types for the versionAlgorithm[x] field in StructureMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for StructureMapVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 reference to structure definition**

 The canonical reference to 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 const 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 = "StructureMapConstBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapConst {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Constant name**

 Other maps used by this map (canonical URLs).

 */
    #[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>,
    /** **FHIRPath exression - value of the constant**

 A FHIRPath expression that is the value of this variable.

 */
    #[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 StructureMapConst {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapConstBuilder {
        StructureMapConstBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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); types | type-and-types**

 If this is the default rule set to apply for the 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(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "typeMode")]
    pub type_mode: Option<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/explanation 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(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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(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>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(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>,
    /** **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>,
    /** **Message to put in log if source exists (FHIRPath)**

 A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.

 This is typically used for recording that something Is not transformed to the target for some reason. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "logMessage")]
    pub log_message: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_logMessage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub log_message_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRuleSource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleSourceBuilder {
        StructureMapGroupRuleSourceBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Variable this rule applies to**

 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>,
    /** **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 | single**

 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
}
/// 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),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Parameter to pass to the rule or group**

 Parameter to pass to the rule or group.

 */
    #[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 StructureMapGroupRuleDependent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleDependentBuilder {
        StructureMapGroupRuleDependentBuilder::default()
    }
}
/** The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.

 **[Subscription](http://hl7.org/fhir/StructureDefinition/Subscription) v5.0.0**

 Notification about a SubscriptionTopic

 The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Subscription(pub Box<SubscriptionInner>);
/** The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.

 **[Subscription](http://hl7.org/fhir/StructureDefinition/Subscription) v5.0.0**

 Notification about a SubscriptionTopic

 The subscription resource describes a particular client's request to be notified about a SubscriptionTopic.

 */
#[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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifiers (business identifier)**

 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.

 */
    #[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>>,
    /** **Human readable name for this subscription**

 A natural language name identifying the subscription.

 */
    #[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>,
    /** **[SubscriptionStatusCodes](http://hl7.org/fhir/ValueSet/subscription-status); requested | active | error | off | entered-in-error**

 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: 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>,
    /** **Reference to the subscription topic being subscribed to**

 The reference to the subscription topic to be notified about.

 */
    #[serde(rename = "topic")]
    pub topic: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_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>,
    /** **Entity responsible for Subscription changes**

 Entity with authorization to make subsequent revisions to the Subscription and also determines what data the subscription is authorized to disclose.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingEntity")]
    pub managing_entity: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingEntity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_entity_ext: Option<FieldExtension>,
    /** **Description of why this subscription was created**

 A description of why this subscription is defined.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<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>,
    /** **Criteria for narrowing the subscription topic stream**

 The filter properties to be applied to narrow the subscription topic stream.  When multiple filters are applied, evaluates to true if all the conditions applicable to that resource are met; otherwise it returns false (i.e., logical AND).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "filterBy")]
    pub filter_by: Vec<Option<SubscriptionFilterBy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_filterBy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub filter_by_ext: Vec<Option<FieldExtension>>,
    /** **[SubscriptionChannelType](http://hl7.org/fhir/ValueSet/subscription-channel-type); Channel type for notifications**

 The type of channel to send notifications on.

 */
    #[serde(rename = "channelType")]
    pub channel_type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_channelType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub channel_type_ext: Option<FieldExtension>,
    /** **Where the channel points to**

 The url that describes the actual end-point to send notifications to.

 For rest-hook the end-point must be an `http:` or `https:` URL; for websockets, `ws:` or `wss:`; for email, a `mailto:` url; and for message the endpoint can be in any form of url the server understands (usually, `http/s`: or `mllp:`). The URI is allowed to be relative; in which case, it is relative to the server end-point (since there 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>,
    /** **Channel type**

 Channel-dependent information to send as part of the notification (e.g., HTTP Headers).

 Exactly what these mean depend on the channel type. They can convey additional information to the server or recipient and/or meet security requirements; for example, support of multiple headers in the outgoing notifications for rest-hook type subscriptions. Note that names are not required to be unique, but channel definitions can impose restrictions. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<SubscriptionParameter>>,
    /// 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>>,
    /** **Interval in seconds to send 'heartbeat' notification**

 If present, a 'heartbeat' notification (keep-alive) is sent via this channel with an interval period equal to this elements integer value in seconds.  If not present, a heartbeat notification is not sent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "heartbeatPeriod")]
    pub heartbeat_period: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_heartbeatPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub heartbeat_period_ext: Option<FieldExtension>,
    /** **Timeout in seconds to attempt notification delivery**

 If present, the maximum amount of time a server will allow before failing a notification attempt.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timeout")]
    pub timeout: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_timeout")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timeout_ext: Option<FieldExtension>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); MIME type to send, or omit for no payload**

 The MIME type to send the payload in - e.g., `application/fhir+xml` or `application/fhir+json`. Note that:

* clients may request notifications in a specific FHIR version by using the [FHIR Version Parameter](http.html#version-parameter) - e.g., `application/fhir+json; fhirVersion=4.0`.

* additional MIME types can be allowed by channels - e.g., `text/plain` and `text/html` are defined by the Email channel.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contentType")]
    pub content_type: Option<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>,
    /** **[SubscriptionPayloadContent](http://hl7.org/fhir/ValueSet/subscription-payload-content); empty | id-only | full-resource**

 How much of the resource content to deliver in the notification payload. The choices are an empty payload, only the resource id, or the full resource content.

 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 = "content")]
    pub content: Option<codes::SubscriptionPayloadContent>,
    /// 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>,
    /** **Maximum number of events that can be combined in a single notification**

 If present, the maximum number of events that will be included in a notification bundle. Note that this is not a strict limit on the number of entries in a bundle, as dependent resources can be included.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxCount")]
    pub max_count: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxCount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_count_ext: 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 filterBy 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 = "SubscriptionFilterByBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionFilterBy {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/subscription-types); Allowed Resource (reference to definition) for this Subscription filter**

 A resource listed in the `SubscriptionTopic` this `Subscription` references (`SubscriptionTopic.canFilterBy.resource`). This element can be used to differentiate filters for topics that include more than one resource type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resourceType")]
    pub resource_type: Option<String>,
    /// 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>,
    /** **Filter label defined in SubscriptionTopic**

 The filter as defined in the `SubscriptionTopic.canFilterBy.filterParameter` element.

 */
    #[serde(rename = "filterParameter")]
    pub filter_parameter: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_filterParameter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub filter_parameter_ext: Option<FieldExtension>,
    /** **[SearchComparator](http://hl7.org/fhir/ValueSet/search-comparator); eq | ne | gt | lt | ge | le | sa | eb | ap**

 Comparator applied to this filter parameter.

 Must be a comparator allowed by the SubscriptionTopic relevant to this Subscription filter. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comparator")]
    pub comparator: Option<codes::SearchComparator>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comparator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comparator_ext: Option<FieldExtension>,
    /** **[SearchModifierCode](http://hl7.org/fhir/ValueSet/search-modifier-code); missing | exact | contains | not | text | in | not-in | below | above | type | identifier | of-type | code-text | text-advanced | iterate**

 Modifier applied to this filter parameter.

 Must be a modifier allowed by the SubscriptionTopic relevant to this Subscription filter. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Option<codes::SearchModifierCode>,
    /// 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>,
    /** **Literal value or resource path**

 The literal value or resource path as is legal in search - for example, `Patient/123` or `le1950`.

 */
    #[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 SubscriptionFilterBy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionFilterByBuilder {
        SubscriptionFilterByBuilder::default()
    }
}
/// Sub-fields of the parameter 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 = "SubscriptionParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 (key) of the parameter**

 Parameter name for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the name would be Authorization.

 */
    #[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 parameter to use or pass through**

 Parameter value for information passed to the channel for notifications, for example in the case of a REST hook wanting to pass through an authorization header, the value would be `Bearer 0193...`.

 */
    #[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 SubscriptionParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionParameterBuilder {
        SubscriptionParameterBuilder::default()
    }
}
/** The SubscriptionStatus resource describes the state of a Subscription during notifications. It is not persisted.

 **[SubscriptionStatus](http://hl7.org/fhir/StructureDefinition/SubscriptionStatus) v5.0.0**

 Status information about a Subscription provided during event notification

 The SubscriptionStatus resource describes the state of a Subscription during notifications.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubscriptionStatus(pub Box<SubscriptionStatusInner>);
/** The SubscriptionStatus resource describes the state of a Subscription during notifications. It is not persisted.

 **[SubscriptionStatus](http://hl7.org/fhir/StructureDefinition/SubscriptionStatus) v5.0.0**

 Status information about a Subscription provided during event notification

 The SubscriptionStatus resource describes the state of a Subscription during notifications.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionStatusBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubscriptionStatusInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubscriptionStatus::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubscriptionStatus", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 | entered-in-error**

 The status of the subscription, which marks the server state for managing the subscription.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<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>,
    /** **[SubscriptionNotificationType](http://hl7.org/fhir/ValueSet/subscription-notification-type); handshake | heartbeat | event-notification | query-status | query-event**

 The type of event being conveyed with this notification.

 */
    #[serde(rename = "type")]
    pub r#type: codes::SubscriptionNotificationType,
    /// 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>,
    /** **Events since the Subscription was created**

 The total number of actual events which have been generated since the Subscription was created (inclusive of this notification) - regardless of how many have been successfully communicated.  This number is NOT incremented for handshake and heartbeat notifications.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventsSinceSubscriptionStart")]
    pub events_since_subscription_start: Option<Integer64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eventsSinceSubscriptionStart")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub events_since_subscription_start_ext: Option<FieldExtension>,
    /** **Detailed information about any events relevant to this notification**

 Detailed information about events relevant to this subscription notification.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notificationEvent")]
    pub notification_event: Vec<Option<SubscriptionStatusNotificationEvent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_notificationEvent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub notification_event_ext: Vec<Option<FieldExtension>>,
    /** **Reference to the Subscription responsible for this notification**

 The reference to the Subscription which generated this notification.

 */
    #[serde(rename = "subscription")]
    pub subscription: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subscription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subscription_ext: Option<FieldExtension>,
    /** **Reference to the SubscriptionTopic this notification relates to**

 The reference to the SubscriptionTopic for the Subscription which generated this notification.

 This value SHOULD NOT be present when using `empty` payloads, MAY be present when using `id-only` payloads, and SHOULD be present when using `full-resource` payloads. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub topic_ext: Option<FieldExtension>,
    /** **[SubscriptionError](http://hl7.org/fhir/ValueSet/subscription-error); List of errors on the subscription**

 A record of errors that occurred when the server processed a notification.

 Recommended practice: clear errors when status is updated. */
    #[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>>,
}
#[cfg(feature = "builders")]
impl SubscriptionStatusBuilder {
    #[doc = concat!("Finalize building ", "SubscriptionStatus", ".")]
    pub fn build(self) -> Result<SubscriptionStatus, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubscriptionStatusInner> for SubscriptionStatus {
    fn from(inner: SubscriptionStatusInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubscriptionStatus {
    type Target = SubscriptionStatusInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubscriptionStatus {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubscriptionStatus {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubscriptionStatusBuilder {
        SubscriptionStatusBuilder::default()
    }
}
impl SubscriptionStatus {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubscriptionStatus
    }
}
/// Sub-fields of the notificationEvent field in SubscriptionStatus
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionStatusNotificationEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionStatusNotificationEvent {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Sequencing index of this event**

 Either the sequential number of this event in this subscription context or a relative event number for this notification.

 In subscriptions where delivery of notifications IS NOT guaranteed (e.g., REST-Hook), this number is a unique and monotonically-increasing event number for a subscription. In channels where delivery of notifications IS guaranteed, this number is a relative index for the events present in the notification (e.g., 1, 2, etc.). */
    #[serde(rename = "eventNumber")]
    pub event_number: Integer64,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eventNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_number_ext: Option<FieldExtension>,
    /** **The instant this event occurred**

 The actual time this event occurred on the server.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "timestamp")]
    pub timestamp: Option<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>,
    /** **Reference to the primary resource or information of this event**

 The focus of this event. While this will usually be a reference to the focus resource of the event, it MAY contain a reference to a non-FHIR object.

 */
    #[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>,
    /** **References related to the focus resource and/or context of this event**

 Additional context information for this event. Generally, this will contain references to additional resources included with the event (e.g., the Patient relevant to an Encounter), however it MAY refer to non-FHIR objects.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additionalContext")]
    pub additional_context: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_additionalContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub additional_context_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubscriptionStatusNotificationEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionStatusNotificationEventBuilder {
        SubscriptionStatusNotificationEventBuilder::default()
    }
}
/** Describes a stream of resource state changes identified by trigger criteria and annotated with labels useful to filter projections from this topic.

 **[SubscriptionTopic](http://hl7.org/fhir/StructureDefinition/SubscriptionTopic) v5.0.0**

 The definition of a specific topic for triggering events within the Subscriptions framework

 Describes a stream of resource state changes or events and annotated with labels useful to filter projections from this topic.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubscriptionTopic(pub Box<SubscriptionTopicInner>);
/** Describes a stream of resource state changes identified by trigger criteria and annotated with labels useful to filter projections from this topic.

 **[SubscriptionTopic](http://hl7.org/fhir/StructureDefinition/SubscriptionTopic) v5.0.0**

 The definition of a specific topic for triggering events within the Subscriptions framework

 Describes a stream of resource state changes or events and annotated with labels useful to filter projections from this topic.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubscriptionTopicInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubscriptionTopic::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubscriptionTopic", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this subscription topic, represented as an absolute URI (globally unique)**

 An absolute URI that is used to identify this subscription topic when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this subscription topic is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the subscription topic is stored on different servers.

 Can be a `urn:uuid:` or a `urn:oid:` but real `http/s:` addresses are preferred.  Multiple instances may share the same URL if they have a distinct version.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found.

When this is a locally defined topic or derived from a topic defined in the FHIR spec or an IG, this uniquely identifies the topic and functionality. Ideally this URL resolves to documentation about the use cases.

When this is a topic derived from another topic (e.g., it adds additional filters or functionality to a topic defined in an IG), then this URL should be different than the base and the `derivedFromCanonical` should be filled out with the unique uri as defined in the IG.

When this is a direct implementation from another IG or registered topic (with no additional filters, etc., so not derived), then this url is the unique url for this topic as defined by the IG. */
    #[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 identifier for subscription topic**

 Business identifiers assigned to this subscription topic by the performer and/or other systems.  These identifiers remain constant as the resource is updated and propagates from server to server.

 Note: This is a business identifier, not a resource identifier (see [discussion](resource.html#identifiers)).  It is best practice for the identifier to only appear on a single resource instance, however business practices may occasionally dictate that multiple resource instances with the same identifier can exist - possibly even with different resource types.  For example, multiple Patient and a Person resource instance might share the same social insurance 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>>,
    /** **Business version of the subscription topic**

 The identifier that is used to identify this version of the subscription topic when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the Topic 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 are orderable.

 There may be multiple different instances of a subscription topic that have the same identifier but different versions. */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<SubscriptionTopicVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<SubscriptionTopicVersionAlgorithmExtension>,
    /** **Name for this subscription topic (computer friendly)**

 A natural language name identifying the subscription topic 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 alphanumeric type name to ensure that it is machine-processing 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 subscription topic (human friendly)**

 A short, descriptive, user-friendly title for the subscription topic.  For example, "admission".

 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>,
    /** **Based on FHIR protocol or definition**

 The canonical URL pointing to another FHIR-defined SubscriptionTopic that is adhered to in whole or in part by this SubscriptionTopic.

 */
    #[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<String>>,
    /// 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>>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The current state of the SubscriptionTopic.

 A nominal state-transition diagram can be found in the [Definition pattern](definition.html#statemachine) documentation

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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **If for testing purposes, not real usage**

 A flag to indicate that this TopSubscriptionTopicic is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of SubscriptionTopic that are appropriate for use vs. not. */
    #[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 status first applied**

 The date (and optionally time) when the subscription topic was last significantly changed. The date must change 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 subscription topic changes.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 name of the individual or organization that published the SubscriptionTopic**

 Helps establish the "authority/credibility" of the SubscriptionTopic.  May also allow for contact.

 */
    #[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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 SubscriptionTopic**

 A free text natural language description of the Topic from the consumer's perspective.

 This description can be used to capture details such as comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the module as conveyed in the text field of the resource itself. 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 = "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>,
    /** **Content intends to support these contexts**

 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 of code system definitions.

 When multiple usageContexts are specified, there is no expectation for 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 of the SubscriptionTopic (if applicable)**

 A jurisdiction in which the Topic is intended to be used.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 SubscriptionTopic is defined**

 Explains why this Topic is needed and why it has been designed as it has.

 This element does not describe the usage of the Topic.  Rather it is for 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 Topic. */
    #[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 SubscriptionTopic and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SubscriptionTopic.

 ... */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When SubscriptionTopic is/was approved by publisher**

 The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The date 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>,
    /** **Date the Subscription Topic was last reviewed by the publisher**

 The date on which the asset content was last reviewed. Review happens periodically after that, 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>,
    /** **The effective date range for the SubscriptionTopic**

 The period during which the SubscriptionTopic content was or is planned to be effective.

 The effective period for a SubscriptionTopic  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 would 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>,
    /** **Definition of a resource-based trigger for the subscription topic**

 A definition of a resource-based event that triggers a notification based on the SubscriptionTopic. The criteria may be just a human readable description and/or a full FHIR search string or FHIRPath expression. Multiple triggers are considered OR joined (e.g., a resource update matching ANY of the definitions will trigger a notification).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resourceTrigger")]
    pub resource_trigger: Vec<Option<SubscriptionTopicResourceTrigger>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resourceTrigger")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_trigger_ext: Vec<Option<FieldExtension>>,
    /** **Event definitions the SubscriptionTopic**

 Event definition which can be used to trigger the SubscriptionTopic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventTrigger")]
    pub event_trigger: Vec<Option<SubscriptionTopicEventTrigger>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_eventTrigger")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_trigger_ext: Vec<Option<FieldExtension>>,
    /** **Properties by which a Subscription can filter notifications from the SubscriptionTopic**

 List of properties by which Subscriptions on the SubscriptionTopic can be filtered. May be defined Search Parameters (e.g., Encounter.patient) or parameters defined within this SubscriptionTopic context (e.g., hub.event).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "canFilterBy")]
    pub can_filter_by: Vec<Option<SubscriptionTopicCanFilterBy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_canFilterBy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub can_filter_by_ext: Vec<Option<FieldExtension>>,
    /** **Properties for describing the shape of notifications generated by this topic**

 List of properties to describe the shape (e.g., resources) included in notifications from this Subscription Topic.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notificationShape")]
    pub notification_shape: Vec<Option<SubscriptionTopicNotificationShape>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_notificationShape")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub notification_shape_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicBuilder {
    #[doc = concat!("Finalize building ", "SubscriptionTopic", ".")]
    pub fn build(self) -> Result<SubscriptionTopic, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubscriptionTopicInner> for SubscriptionTopic {
    fn from(inner: SubscriptionTopicInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubscriptionTopic {
    type Target = SubscriptionTopicInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubscriptionTopic {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubscriptionTopic {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubscriptionTopicBuilder {
        SubscriptionTopicBuilder::default()
    }
}
impl SubscriptionTopic {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubscriptionTopic
    }
}
/// Choice of types for the versionAlgorithm[x] field in SubscriptionTopic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubscriptionTopicVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for SubscriptionTopicVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubscriptionTopicVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the resourceTrigger field in SubscriptionTopic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicResourceTriggerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionTopicResourceTrigger {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Text representation of the resource trigger**

 The human readable description of this resource trigger for the SubscriptionTopic -  for example, "An Encounter enters the 'in-progress' state".

 Implementation of particular subscription topics might not use a computable definition and instead base their design on the 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/subscription-types); Data Type or Resource (reference to definition) for this trigger definition**

 URL of the Resource that is the type used in this resource trigger.  Relative URLs are relative to the StructureDefinition root of the implemented FHIR version (e.g., http://hl7.org/fhir/StructureDefinition). For example, "Patient" maps to http://hl7.org/fhir/StructureDefinition/Patient.  For more information, see <a href="elementdefinition-definitions.html#ElementDefinition.type.code">ElementDefinition.type.code</a>.

 */
    #[serde(rename = "resource")]
    pub resource: 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>,
    /** **[MethodCode](http://hl7.org/fhir/ValueSet/interaction-trigger); create | update | delete**

 The FHIR RESTful interaction which can be used to trigger a notification for the SubscriptionTopic. Multiple values are considered OR joined (e.g., CREATE or UPDATE). If not present, all supported interactions are assumed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportedInteraction")]
    pub supported_interaction: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportedInteraction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supported_interaction_ext: Vec<Option<FieldExtension>>,
    /** **Query based trigger rule**

 The FHIR query based rules that the server should use to determine when to trigger a notification for this subscription topic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "queryCriteria")]
    pub query_criteria: Option<SubscriptionTopicResourceTriggerQueryCriteria>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_queryCriteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub query_criteria_ext: Option<FieldExtension>,
    /** **FHIRPath based trigger rule**

 The FHIRPath based rules that the server should use to determine when to trigger a notification for this topic.

 FHIRPath expression with %previous and %current vars. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fhirPathCriteria")]
    pub fhir_path_criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fhirPathCriteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fhir_path_criteria_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicResourceTrigger {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionTopicResourceTriggerBuilder {
        SubscriptionTopicResourceTriggerBuilder::default()
    }
}
/// Sub-fields of the queryCriteria field in SubscriptionTopicResourceTrigger
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicResourceTriggerQueryCriteriaBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionTopicResourceTriggerQueryCriteria {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Rule applied to previous resource state**

 The FHIR query based rules are applied to the previous resource state (e.g., state before an update).

 The rules are search criteria (without the [base] part). Like Bundle.entry.request.url, it has no leading slash character (`/`). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "previous")]
    pub previous: Option<String>,
    /// 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>,
    /** **[CriteriaNotExistsBehavior](http://hl7.org/fhir/ValueSet/subscriptiontopic-cr-behavior); test-passes | test-fails**

 For `create` interactions, should the `previous` criteria count as an automatic pass or an automatic fail. If not present, the testing behavior during `create` interactions is unspecified (server discretion).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resultForCreate")]
    pub result_for_create: Option<codes::CriteriaNotExistsBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resultForCreate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_for_create_ext: Option<FieldExtension>,
    /** **Rule applied to current resource state**

 The FHIR query based rules are applied to the current resource state (e.g., state after an update).

 The rules are search criteria (without the [base] part). Like Bundle.entry.request.url, it has no leading slash character (`/`). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "current")]
    pub current: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_current")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub current_ext: Option<FieldExtension>,
    /** **[CriteriaNotExistsBehavior](http://hl7.org/fhir/ValueSet/subscriptiontopic-cr-behavior); test-passes | test-fails**

 For 'delete' interactions, should the 'current' query criteria count as an automatic pass or an automatic fail. If not present, the testing behavior during `delete` interactions is unspecified (server discretion).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resultForDelete")]
    pub result_for_delete: Option<codes::CriteriaNotExistsBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resultForDelete")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_for_delete_ext: Option<FieldExtension>,
    /** **Both must be true flag**

 If set to `true`, both the `current` and `previous` query criteria must evaluate `true` to trigger a notification for this topic.  If set to `false` or not present, a notification for this topic will be triggered if either the `current` or `previous` tests evaluate to `true`.

 Please note the interaction between this element and the `resultForCreate`/`resultForDelete` elements during `create` and `delete` interactions.  For example, if `resultForCreate` is set to `test-passes`, setting `requireBoth` to `false` means that every `create` will trigger a notification while setting `requireBoth` to `true` will result in notifications if the `current` test passes.  Similarly, if `resultForCreate` is set to `test-fails`, setting `requireBoth` to `true` means that no `create` will be able to generate a notification while setting `requireBoth` to `false` will result in notifications if the `current` test passes. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requireBoth")]
    pub require_both: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requireBoth")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub require_both_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicResourceTriggerQueryCriteria {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionTopicResourceTriggerQueryCriteriaBuilder {
        SubscriptionTopicResourceTriggerQueryCriteriaBuilder::default()
    }
}
/// Sub-fields of the eventTrigger field in SubscriptionTopic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicEventTriggerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionTopicEventTrigger {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Text representation of the event trigger**

 The human readable description of an event to trigger a notification for the SubscriptionTopic - for example, "Patient Admission, as defined in HL7v2 via message ADT^A01". Multiple values are considered OR joined (e.g., matching any single event listed).

 Implementation of particular subscription topics might not use a computable definition and instead base their design on the 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>,
    /** **[SubscriptionTopicEventTrigger](http://terminology.hl7.org/ValueSet/v2-0003); Event which can trigger a notification from the SubscriptionTopic**

 A well-defined event which can be used to trigger notifications from the SubscriptionTopic.

 */
    #[serde(rename = "event")]
    pub event: CodeableConcept,
    /// 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/subscription-types); Data Type or Resource (reference to definition) for this trigger definition**

 URL of the Resource that is the focus type used in this event trigger.  Relative URLs are relative to the StructureDefinition root of the implemented FHIR version (e.g., http://hl7.org/fhir/StructureDefinition). For example, "Patient" maps to http://hl7.org/fhir/StructureDefinition/Patient.  For more information, see <a href="elementdefinition-definitions.html#ElementDefinition.type.code">ElementDefinition.type.code</a>.

 */
    #[serde(rename = "resource")]
    pub resource: 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>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicEventTrigger {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionTopicEventTriggerBuilder {
        SubscriptionTopicEventTriggerBuilder::default()
    }
}
/// Sub-fields of the canFilterBy field in SubscriptionTopic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicCanFilterByBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionTopicCanFilterBy {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of this filter parameter**

 Description of how this filtering parameter is intended to 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>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/subscription-types); URL of the triggering Resource that this filter applies to**

 URL of the Resource that is the type used in this filter. This is the "focus" of the topic (or one of them if there are more than one). It will be the same, a generality, or a specificity of SubscriptionTopic.resourceTrigger.resource or SubscriptionTopic.eventTrigger.resource when they are present.

 URL of the Resource that is the type used in this filter. Relative URLs are relative to the StructureDefinition root of the implemented FHIR version (e.g., http://hl7.org/fhir/StructureDefinition). For example, "Patient" maps to http://hl7.org/fhir/StructureDefinition/Patient. For more information, see <a href="elementdefinition-definitions.html#ElementDefinition.type.code">ElementDefinition.type.code</a>. */
    #[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>,
    /** **Human-readable and computation-friendly name for a filter parameter usable by subscriptions on this topic, via Subscription.filterBy.filterParameter**

 Either the canonical URL to a search parameter (like "http://hl7.org/fhir/SearchParameter/encounter-patient") or topic-defined parameter (like "hub.event") which is a label for the filter.

 Chained parameters are allowed (like "patient.gender") - but can not use colons or modifiers. */
    #[serde(rename = "filterParameter")]
    pub filter_parameter: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_filterParameter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub filter_parameter_ext: Option<FieldExtension>,
    /** **Canonical URL for a filterParameter definition**

 Either the canonical URL to a search parameter (like "http://hl7.org/fhir/SearchParameter/encounter-patient") or the officially-defined URI for a shared filter concept (like "http://example.org/concepts/shared-common-event").

 Chained parameters are allowed (like "patient.gender") - but can not use colons or modifiers. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "filterDefinition")]
    pub filter_definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_filterDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub filter_definition_ext: Option<FieldExtension>,
    /** **[SearchComparator](http://hl7.org/fhir/ValueSet/search-comparator); eq | ne | gt | lt | ge | le | sa | eb | ap**

 Comparators allowed for the filter 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 | identifier | of-type | code-text | text-advanced | iterate**

 Modifiers allowed for the filter parameter.

 If no modifiers are listed, clients should not expect servers to support any modifiers. */
    #[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>>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicCanFilterBy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionTopicCanFilterByBuilder {
        SubscriptionTopicCanFilterByBuilder::default()
    }
}
/// Sub-fields of the notificationShape field in SubscriptionTopic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionTopicNotificationShapeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionTopicNotificationShape {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[FHIRTypes](http://hl7.org/fhir/ValueSet/subscription-types); URL of the Resource that is the focus (main) resource in a notification shape**

 URL of the Resource that is the type used in this shape. This is the 'focus' resource of the topic (or one of them if there are more than one) and the root resource for this shape definition. It will be the same, a generality, or a specificity of SubscriptionTopic.resourceTrigger.resource or SubscriptionTopic.eventTrigger.resource when they are present.

 URL of the Resource that is the type used in this shape. Relative URLs are relative to the StructureDefinition root of the implemented FHIR version (e.g., http://hl7.org/fhir/StructureDefinition). For example, 'Patient' maps to http://hl7.org/fhir/StructureDefinition/Patient. For more information, see <a href="elementdefinition-definitions.html#ElementDefinition.type.code">ElementDefinition.type.code</a>. */
    #[serde(rename = "resource")]
    pub resource: 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>,
    /** **Include directives, rooted in the resource for this shape**

 Search-style _include directives, rooted in the resource for this shape. Servers SHOULD include resources listed here, if they exist and the user is authorized to receive them.  Clients SHOULD be prepared to receive these additional resources, but SHALL function properly without them.

 */
    #[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>>,
    /** **Reverse include directives, rooted in the resource for this shape**

 Search-style _revinclude directives, rooted in the resource for this shape. Servers SHOULD include resources listed here, if they exist and the user is authorized to receive them.  Clients SHOULD be prepared to receive these additional resources, but SHALL function properly without them.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revInclude")]
    pub rev_include: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_revInclude")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rev_include_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubscriptionTopicNotificationShape {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionTopicNotificationShapeBuilder {
        SubscriptionTopicNotificationShapeBuilder::default()
    }
}
/** A homogeneous material with a definite composition.

 **[Substance](http://hl7.org/fhir/StructureDefinition/Substance) v5.0.0**

 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>);
/** A homogeneous material with a definite composition.

 **[Substance](http://hl7.org/fhir/StructureDefinition/Substance) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. For an instance, an identifier associated with the package/container (usually a label affixed directly).

 */
    #[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>>,
    /** **Is this an instance of a substance or a kind of one**

 A boolean to indicate if this an instance of a substance or a kind of one (a definition).

 */
    #[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>,
    /** **[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: CodeableReference,
    /// 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>,
    /** **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>,
    /** **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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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),
}
/** The detailed description of a substance, typically at a level beyond what is used for prescribing.

 **[SubstanceDefinition](http://hl7.org/fhir/StructureDefinition/SubstanceDefinition) v5.0.0**

 The detailed description of a substance, typically at a level beyond what is used for prescribing

 The detailed description of a substance, typically at a level beyond what is used for prescribing.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstanceDefinition(pub Box<SubstanceDefinitionInner>);
/** The detailed description of a substance, typically at a level beyond what is used for prescribing.

 **[SubstanceDefinition](http://hl7.org/fhir/StructureDefinition/SubstanceDefinition) v5.0.0**

 The detailed description of a substance, typically at a level beyond what is used for prescribing

 The detailed description of a substance, typically at a level beyond what is used for prescribing.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstanceDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstanceDefinition", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 by which this substance is known**

 Identifier by which this substance 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>>,
    /** **A business level version identifier of the substance**

 A business level version identifier of the substance.

 */
    #[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); Status of substance within the catalogue e.g. active, retired**

 Status of substance within the catalogue e.g. active, retired.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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>,
    /** **A categorization, high level e.g. polymer or nucleic acid, or food, chemical, biological, or lower e.g. polymer linear or branch chain, or type of impurity**

 A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classification")]
    pub classification: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub classification_ext: Vec<Option<FieldExtension>>,
    /** **[MedicinalProductType](http://hl7.org/fhir/ValueSet/medicinal-product-domain); If the substance applies to human or veterinary use**

 If the substance applies to human or veterinary use.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "domain")]
    pub domain: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_domain")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub domain_ext: Option<FieldExtension>,
    /** **[SubstanceGrade](http://hl7.org/fhir/ValueSet/substance-grade); The quality standard, established benchmark, to which substance complies (e.g. USP/NF, BP)**

 The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "grade")]
    pub grade: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_grade")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub grade_ext: Vec<Option<FieldExtension>>,
    /** **Textual description of the substance**

 Textual description of the substance.

 */
    #[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>,
    /** **Supporting literature**

 Supporting literature.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSource")]
    pub information_source: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationSource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_source_ext: Vec<Option<FieldExtension>>,
    /** **Textual comment about the substance's catalogue or registry record**

 Textual comment about the substance's catalogue or registry record.

 */
    #[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>>,
    /** **The entity that creates, makes, produces or fabricates the substance**

 The entity that creates, makes, produces or fabricates the substance. This is a set of potential manufacturers but is not necessarily comprehensive.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manufacturer_ext: Vec<Option<FieldExtension>>,
    /** **An entity that is the source for the substance. It may be different from the manufacturer**

 An entity that is the source for the substance. It may be different from the manufacturer. Supplier is synonymous to a distributor.

 */
    #[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>>,
    /** **Moiety, for structural modifications**

 Moiety, for structural modifications.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "moiety")]
    pub moiety: Vec<Option<SubstanceDefinitionMoiety>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_moiety")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub moiety_ext: Vec<Option<FieldExtension>>,
    /** **General specifications for this substance**

 General specifications for this substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characterization")]
    pub characterization: Vec<Option<SubstanceDefinitionCharacterization>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_characterization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub characterization_ext: Vec<Option<FieldExtension>>,
    /** **General specifications for this substance**

 General specifications for this substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<SubstanceDefinitionProperty>>,
    /// 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>>,
    /** **General information detailing this substance**

 General information detailing this substance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceInformation")]
    pub reference_information: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceInformation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_information_ext: Option<FieldExtension>,
    /** **The average mass of a molecule of a compound**

 The average mass of a molecule of a compound compared to 1/12 the mass of carbon 12 and calculated as the sum of the atomic weights of the constituent atoms.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "molecularWeight")]
    pub molecular_weight: Vec<Option<SubstanceDefinitionMolecularWeight>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_molecularWeight")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub molecular_weight_ext: Vec<Option<FieldExtension>>,
    /** **Structural information**

 Structural information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "structure")]
    pub structure: Option<SubstanceDefinitionStructure>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_structure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub structure_ext: Option<FieldExtension>,
    /** **Codes associated with the substance**

 Codes associated with the substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<SubstanceDefinitionCode>>,
    /// 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>>,
    /** **Names applicable to this substance**

 Names applicable to this substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<SubstanceDefinitionName>>,
    /// 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 link between this substance and another**

 A link between this substance and another, with details of the relationship.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Vec<Option<SubstanceDefinitionRelationship>>,
    /// 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>>,
    /** **Data items specific to nucleic acids**

 Data items specific to nucleic acids.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nucleicAcid")]
    pub nucleic_acid: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nucleicAcid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub nucleic_acid_ext: Option<FieldExtension>,
    /** **Data items specific to polymers**

 Data items specific to polymers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "polymer")]
    pub polymer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_polymer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub polymer_ext: Option<FieldExtension>,
    /** **Data items specific to proteins**

 Data items specific to proteins.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protein")]
    pub protein: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_protein")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub protein_ext: Option<FieldExtension>,
    /** **Material or taxonomic/anatomical source**

 Material or taxonomic/anatomical source for the substance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceMaterial")]
    pub source_material: Option<SubstanceDefinitionSourceMaterial>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceMaterial")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_material_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionBuilder {
    #[doc = concat!("Finalize building ", "SubstanceDefinition", ".")]
    pub fn build(self) -> Result<SubstanceDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceDefinitionInner> for SubstanceDefinition {
    fn from(inner: SubstanceDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstanceDefinition {
    type Target = SubstanceDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstanceDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstanceDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceDefinitionBuilder {
        SubstanceDefinitionBuilder::default()
    }
}
impl SubstanceDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstanceDefinition
    }
}
/// Sub-fields of the moiety field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionMoietyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionMoiety {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 that the moiety is playing**

 Role that the moiety is playing.

 */
    #[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>,
    /** **Identifier by which this moiety substance is known**

 Identifier by which this moiety substance is known.

 */
    #[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>,
    /** **Textual name for this moiety substance**

 Textual name for this moiety substance.

 */
    #[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>,
    /** **[SubstanceStereochemistry](http://hl7.org/fhir/ValueSet/substance-stereochemistry); Stereochemistry type**

 Stereochemistry type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stereochemistry")]
    pub stereochemistry: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stereochemistry")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stereochemistry_ext: Option<FieldExtension>,
    /** **[SubstanceOpticalActivity](http://hl7.org/fhir/ValueSet/substance-optical-activity); Optical activity type**

 Optical activity type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "opticalActivity")]
    pub optical_activity: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_opticalActivity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub optical_activity_ext: Option<FieldExtension>,
    /** **Molecular formula for this moiety (e.g. with the Hill system)**

 Molecular formula for this moiety of this substance, typically using the Hill system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "molecularFormula")]
    pub molecular_formula: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_molecularFormula")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub molecular_formula_ext: Option<FieldExtension>,
    /** **Quantitative value for this moiety**

 Quantitative value for this moiety.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub amount: Option<SubstanceDefinitionMoietyAmount>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<SubstanceDefinitionMoietyAmountExtension>,
    /** **[SubstanceAmountType](http://hl7.org/fhir/ValueSet/substance-amount-type); The measurement type of the quantitative value**

 The measurement type of the quantitative value. In capturing the actual relative amounts of substances or molecular fragments it may be necessary to indicate whether the amount refers to, for example, a mole ratio or weight ratio.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measurementType")]
    pub measurement_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionMoiety {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionMoietyBuilder {
        SubstanceDefinitionMoietyBuilder::default()
    }
}
/// Choice of types for the amount[x] field in SubstanceDefinitionMoiety
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionMoietyAmount {
    /// Variant accepting the Quantity type.
    #[serde(rename = "amountQuantity")]
    Quantity(Quantity),
    /// Variant accepting the String type.
    #[serde(rename = "amountString")]
    String(String),
}
/// Extension value for SubstanceDefinitionMoietyAmount.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionMoietyAmountExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_amountQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_amountString")]
    String(FieldExtension),
}
/// Sub-fields of the characterization field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionCharacterizationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionCharacterization {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceStructureTechnique](http://hl7.org/fhir/ValueSet/substance-structure-technique); The method used to find the characterization e.g. HPLC**

 The method used to elucidate the characterization of the drug substance. Example: HPLC.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "technique")]
    pub technique: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_technique")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub technique_ext: Option<FieldExtension>,
    /** **[SubstanceForm](http://hl7.org/fhir/ValueSet/substance-form); Describes the nature of the chemical entity and explains, for instance, whether this is a base or a salt form**

 Describes the nature of the chemical entity and explains, for instance, whether this is a base or a salt 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>,
    /** **The description or justification in support of the interpretation of the data file**

 The description or justification in support of the interpretation of the data file.

 */
    #[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 data produced by the analytical instrument or a pictorial representation of that data. Examples: a JCAMP, JDX, or ADX file, or a chromatogram or spectrum analysis**

 The data produced by the analytical instrument or a pictorial representation of that data. Examples: a JCAMP, JDX, or ADX file, or a chromatogram or spectrum analysis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "file")]
    pub file: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_file")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub file_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionCharacterization {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionCharacterizationBuilder {
        SubstanceDefinitionCharacterizationBuilder::default()
    }
}
/// Sub-fields of the property field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SNOMEDCTCharacteristicCodes](http://hl7.org/fhir/ValueSet/product-characteristic-codes); A code expressing the type of property**

 A code expressing the type of property.

 */
    #[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>,
    /** **A value for the property**

 A value for the property.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<SubstanceDefinitionPropertyValue>,
    /// 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<SubstanceDefinitionPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionPropertyBuilder {
        SubstanceDefinitionPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in SubstanceDefinitionProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionPropertyValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
}
/// Extension value for SubstanceDefinitionPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionPropertyValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
}
/// Sub-fields of the molecularWeight field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionMolecularWeightBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionMolecularWeight {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceWeightMethod](http://hl7.org/fhir/ValueSet/substance-weight-method); The method by which the weight was determined**

 The method by which the molecular weight was determined.

 */
    #[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>,
    /** **[SubstanceWeightType](http://hl7.org/fhir/ValueSet/substance-weight-type); Type of molecular weight e.g. exact, average, weight average**

 Type of molecular weight such as exact, average (also known as. number average), weight average.

 */
    #[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>,
    /** **Used to capture quantitative values for a variety of elements**

 Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.

 */
    #[serde(rename = "amount")]
    pub amount: 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 SubstanceDefinitionMolecularWeight {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionMolecularWeightBuilder {
        SubstanceDefinitionMolecularWeightBuilder::default()
    }
}
/// Sub-fields of the structure field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionStructureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionStructure {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceStereochemistry](http://hl7.org/fhir/ValueSet/substance-stereochemistry); Stereochemistry type**

 Stereochemistry type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stereochemistry")]
    pub stereochemistry: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stereochemistry")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stereochemistry_ext: Option<FieldExtension>,
    /** **[SubstanceOpticalActivity](http://hl7.org/fhir/ValueSet/substance-optical-activity); Optical activity type**

 Optical activity type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "opticalActivity")]
    pub optical_activity: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_opticalActivity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub optical_activity_ext: Option<FieldExtension>,
    /** **An expression which states the number and type of atoms present in a molecule of a substance**

 An expression which states the number and type of atoms present in a molecule of a substance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "molecularFormula")]
    pub molecular_formula: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_molecularFormula")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub molecular_formula_ext: Option<FieldExtension>,
    /** **Specified per moiety according to the Hill system**

 Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "molecularFormulaByMoiety")]
    pub molecular_formula_by_moiety: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_molecularFormulaByMoiety")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub molecular_formula_by_moiety_ext: Option<FieldExtension>,
    /** **The molecular weight or weight range**

 The molecular weight or weight range (for proteins, polymers or nucleic acids).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "molecularWeight")]
    pub molecular_weight: Option<SubstanceDefinitionMolecularWeight>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_molecularWeight")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub molecular_weight_ext: Option<FieldExtension>,
    /** **[SubstanceStructureTechnique](http://hl7.org/fhir/ValueSet/substance-structure-technique); The method used to find the structure e.g. X-ray, NMR**

 The method used to elucidate the structure of the drug substance. Examples: X-ray, NMR, Peptide mapping, Ligand binding assay.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "technique")]
    pub technique: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_technique")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub technique_ext: Vec<Option<FieldExtension>>,
    /** **Source of information for the structure**

 The source of information about the structure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceDocument")]
    pub source_document: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sourceDocument")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub source_document_ext: Vec<Option<FieldExtension>>,
    /** **A depiction of the structure of the substance**

 A depiction of the structure of the substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "representation")]
    pub representation: Vec<Option<SubstanceDefinitionStructureRepresentation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_representation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub representation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionStructure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionStructureBuilder {
        SubstanceDefinitionStructureBuilder::default()
    }
}
/// Sub-fields of the representation field in SubstanceDefinitionStructure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionStructureRepresentationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionStructureRepresentation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceRepresentationType](http://hl7.org/fhir/ValueSet/substance-representation-type); The kind of structural representation (e.g. full, partial)**

 The kind of structural representation (e.g. full, partial).

 */
    #[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 structural representation as a text string in a standard format**

 The structural representation as a text string in a standard format.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "representation")]
    pub representation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_representation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub representation_ext: Option<FieldExtension>,
    /** **[SubstanceRepresentationFormat](http://hl7.org/fhir/ValueSet/substance-representation-format); The format of the representation e.g. InChI, SMILES, MOLFILE (note: not the physical file format)**

 The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "format")]
    pub format: Option<CodeableConcept>,
    /// 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>,
    /** **An attachment with the structural representation e.g. a structure graphic or AnIML file**

 An attached file with the structural representation e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "document")]
    pub document: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_document")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub document_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionStructureRepresentation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionStructureRepresentationBuilder {
        SubstanceDefinitionStructureRepresentationBuilder::default()
    }
}
/// Sub-fields of the code field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionCodeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionCode {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 The specific 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>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); Status of the code assignment, for example 'provisional', 'approved'**

 Status of the code assignment, for example 'provisional', 'approved'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 date at which the code status was changed**

 The date at which the code status was changed as part of the terminology maintenance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<DateTime>,
    /// 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>,
    /** **Any comment can be provided in this field**

 Any comment can be provided in this field, if necessary.

 */
    #[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>>,
    /** **Supporting literature**

 Supporting literature.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionCode {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionCodeBuilder {
        SubstanceDefinitionCodeBuilder::default()
    }
}
/// Sub-fields of the name field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionNameBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionName {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 actual name**

 The actual 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>,
    /** **[SubstanceNameType](http://hl7.org/fhir/ValueSet/substance-name-type); Name type e.g. 'systematic',  'scientific, 'brand'**

 Name type, for example 'systematic',  'scientific, 'brand'.

 */
    #[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); The status of the name e.g. 'current', 'proposed'**

 The status of the name, for example 'current', 'proposed'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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>,
    /** **If this is the preferred name for this substance**

 If this is the preferred name for this substance.

 */
    #[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>,
    /** **[Language](http://hl7.org/fhir/ValueSet/all-languages); Human language that the name is written in**

 Human language that the name is written in.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub language_ext: Vec<Option<FieldExtension>>,
    /** **[SubstanceNameDomain](http://hl7.org/fhir/ValueSet/substance-name-domain); The use context of this name e.g. as an active ingredient or as a food colour additive**

 The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "domain")]
    pub domain: Vec<Option<CodeableConcept>>,
    /// 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>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); The jurisdiction where this name applies**

 The jurisdiction where this name applies.

 */
    #[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>>,
    /** **A synonym of this particular name, by which the substance is also known**

 A synonym of this particular name, by which the substance is also known.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "synonym")]
    pub synonym: Vec<Option<SubstanceDefinitionName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_synonym")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub synonym_ext: Vec<Option<FieldExtension>>,
    /** **A translation for this name into another human language**

 A translation for this name into another human language.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "translation")]
    pub translation: Vec<Option<SubstanceDefinitionName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_translation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub translation_ext: Vec<Option<FieldExtension>>,
    /** **Details of the official nature of this name**

 Details of the official nature of this name.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "official")]
    pub official: Vec<Option<SubstanceDefinitionNameOfficial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_official")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub official_ext: Vec<Option<FieldExtension>>,
    /** **Supporting literature**

 Supporting literature.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionName {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionNameBuilder {
        SubstanceDefinitionNameBuilder::default()
    }
}
/// Sub-fields of the official field in SubstanceDefinitionName
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionNameOfficialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionNameOfficial {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceNameAuthority](http://hl7.org/fhir/ValueSet/substance-name-authority); Which authority uses this official name**

 Which authority uses this official name.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authority")]
    pub authority: Option<CodeableConcept>,
    /// 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>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); The status of the official name, for example 'draft', 'active'**

 The status of the official name, for example 'draft', 'active', 'retired'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<CodeableConcept>,
    /// 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 of official name change**

 Date of the official name change.

 */
    #[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>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionNameOfficial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionNameOfficialBuilder {
        SubstanceDefinitionNameOfficialBuilder::default()
    }
}
/// Sub-fields of the relationship field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionRelationshipBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionRelationship {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 pointer to another substance, as a resource or a representational code**

 A pointer to another substance, as a resource or just a representational code.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub substance_definition: Option<SubstanceDefinitionRelationshipSubstanceDefinition>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub substance_definition_ext: Option<
        SubstanceDefinitionRelationshipSubstanceDefinitionExtension,
    >,
    /** **[SubstanceRelationshipType](http://hl7.org/fhir/ValueSet/substance-relationship-type); For example "salt to parent", "active moiety"**

 For example "salt to parent", "active moiety", "starting material", "polymorph", "impurity of".

 */
    #[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>,
    /** **For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible relationships**

 For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isDefining")]
    pub is_defining: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isDefining")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_defining_ext: Option<FieldExtension>,
    /** **A numeric factor for the relationship, e.g. that a substance salt has some percentage of active substance in relation to some other**

 A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub amount: Option<SubstanceDefinitionRelationshipAmount>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<SubstanceDefinitionRelationshipAmountExtension>,
    /** **For use when the numeric has an uncertain range**

 For use when the numeric has an uncertain range.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ratioHighLimitAmount")]
    pub ratio_high_limit_amount: Option<Ratio>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ratioHighLimitAmount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ratio_high_limit_amount_ext: Option<FieldExtension>,
    /** **[SubstanceAmountType](http://hl7.org/fhir/ValueSet/substance-amount-type); An operator for the amount, for example "average", "approximately", "less than"**

 An operator for the amount, for example "average", "approximately", "less than".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comparator")]
    pub comparator: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comparator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comparator_ext: Option<FieldExtension>,
    /** **Supporting literature**

 Supporting literature.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionRelationship {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionRelationshipBuilder {
        SubstanceDefinitionRelationshipBuilder::default()
    }
}
/// Choice of types for the substanceDefinition[x] field in SubstanceDefinitionRelationship
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionRelationshipSubstanceDefinition {
    /// Variant accepting the Reference type.
    #[serde(rename = "substanceDefinitionReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "substanceDefinitionCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for SubstanceDefinitionRelationshipSubstanceDefinition.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionRelationshipSubstanceDefinitionExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_substanceDefinitionReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_substanceDefinitionCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Choice of types for the amount[x] field in SubstanceDefinitionRelationship
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionRelationshipAmount {
    /// Variant accepting the Quantity type.
    #[serde(rename = "amountQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Ratio type.
    #[serde(rename = "amountRatio")]
    Ratio(Ratio),
    /// Variant accepting the String type.
    #[serde(rename = "amountString")]
    String(String),
}
/// Extension value for SubstanceDefinitionRelationshipAmount.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceDefinitionRelationshipAmountExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_amountQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_amountRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_amountString")]
    String(FieldExtension),
}
/// Sub-fields of the sourceMaterial field in SubstanceDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceDefinitionSourceMaterialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceDefinitionSourceMaterial {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SourceMaterialType](http://hl7.org/fhir/ValueSet/substance-source-material-type); Classification of the origin of the raw material. e.g. cat hair is an Animal source type**

 A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.

 */
    #[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>,
    /** **[SourceMaterialGenus](http://hl7.org/fhir/ValueSet/substance-source-material-genus); The genus of an organism e.g. the Latin epithet of the plant/animal scientific name**

 The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genus")]
    pub genus: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_genus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub genus_ext: Option<FieldExtension>,
    /** **[SourceMaterialSpecies](http://hl7.org/fhir/ValueSet/substance-source-material-species); The species of an organism e.g. the Latin epithet of the species of the plant/animal**

 The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "species")]
    pub species: Option<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>,
    /** **[SourceMaterialPart](http://hl7.org/fhir/ValueSet/substance-source-material-part); An anatomical origin of the source material within an organism**

 An anatomical origin of the source material within an organism.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_ext: Option<FieldExtension>,
    /** **[Country](http://hl7.org/fhir/ValueSet/country); The country or countries where the material is harvested**

 The country or countries where the material is harvested.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "countryOfOrigin")]
    pub country_of_origin: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_countryOfOrigin")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub country_of_origin_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceDefinitionSourceMaterial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceDefinitionSourceMaterialBuilder {
        SubstanceDefinitionSourceMaterialBuilder::default()
    }
}
/** Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction.

 **[SubstanceNucleicAcid](http://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcid) v5.0.0**

 Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction

 Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstanceNucleicAcid(pub Box<SubstanceNucleicAcidInner>);
/** Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction.

 **[SubstanceNucleicAcid](http://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcid) v5.0.0**

 Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction

 Nucleic acids are defined by three distinct elements: the base, sugar and linkage. Individual substance/moiety IDs will be created for each of these elements. The nucleotide sequence will be always entered in the 5’-3’ direction.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceNucleicAcidBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceNucleicAcidInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstanceNucleicAcid::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstanceNucleicAcid", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of the sequence shall be specified based on a controlled vocabulary**

 The type of the sequence shall be specified based on a controlled vocabulary.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceType")]
    pub sequence_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_type_ext: Option<FieldExtension>,
    /** **The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit**

 The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfSubunits")]
    pub number_of_subunits: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfSubunits")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_subunits_ext: Option<FieldExtension>,
    /** **The area of hybridisation shall be described if applicable for double stranded RNA or DNA. The number associated with the subunit followed by the number associated to the residue shall be specified in increasing order. The underscore “” shall be used as separator as follows: “Subunitnumber Residue”**

 The area of hybridisation shall be described if applicable for double stranded RNA or DNA. The number associated with the subunit followed by the number associated to the residue shall be specified in increasing order. The underscore “” shall be used as separator as follows: “Subunitnumber Residue”.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "areaOfHybridisation")]
    pub area_of_hybridisation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_areaOfHybridisation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub area_of_hybridisation_ext: Option<FieldExtension>,
    /** **(TBC)**

 (TBC).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "oligoNucleotideType")]
    pub oligo_nucleotide_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_oligoNucleotideType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub oligo_nucleotide_type_ext: Option<FieldExtension>,
    /** **Subunits are listed in order of decreasing length; sequences of the same length will be ordered by molecular weight; subunits that have identical sequences will be repeated multiple times**

 Subunits are listed in order of decreasing length; sequences of the same length will be ordered by molecular weight; subunits that have identical sequences will be repeated multiple times.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subunit")]
    pub subunit: Vec<Option<SubstanceNucleicAcidSubunit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subunit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subunit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceNucleicAcidBuilder {
    #[doc = concat!("Finalize building ", "SubstanceNucleicAcid", ".")]
    pub fn build(self) -> Result<SubstanceNucleicAcid, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceNucleicAcidInner> for SubstanceNucleicAcid {
    fn from(inner: SubstanceNucleicAcidInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstanceNucleicAcid {
    type Target = SubstanceNucleicAcidInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstanceNucleicAcid {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstanceNucleicAcid {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceNucleicAcidBuilder {
        SubstanceNucleicAcidBuilder::default()
    }
}
impl SubstanceNucleicAcid {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstanceNucleicAcid
    }
}
/// Sub-fields of the subunit field in SubstanceNucleicAcid
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceNucleicAcidSubunitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceNucleicAcidSubunit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Index of linear sequences of nucleic acids in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts**

 Index of linear sequences of nucleic acids in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subunit")]
    pub subunit: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subunit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subunit_ext: Option<FieldExtension>,
    /** **Actual nucleotide sequence notation from 5' to 3' end using standard single letter codes. In addition to the base sequence, sugar and type of phosphate or non-phosphate linkage should also be captured**

 Actual nucleotide sequence notation from 5' to 3' end using standard single letter codes. In addition to the base sequence, sugar and type of phosphate or non-phosphate linkage should also be captured.

 */
    #[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>,
    /** **The length of the sequence shall be captured**

 The length of the sequence shall be captured.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "length")]
    pub length: Option<i32>,
    /// 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>,
    /** **(TBC)**

 (TBC).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceAttachment")]
    pub sequence_attachment: Option<Attachment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceAttachment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_attachment_ext: Option<FieldExtension>,
    /** **The nucleotide present at the 5’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the first position in the sequence. A separate representation would be redundant**

 The nucleotide present at the 5’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the first position in the sequence. A separate representation would be redundant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fivePrime")]
    pub five_prime: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fivePrime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub five_prime_ext: Option<FieldExtension>,
    /** **The nucleotide present at the 3’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the last position in the sequence. A separate representation would be redundant**

 The nucleotide present at the 3’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the last position in the sequence. A separate representation would be redundant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "threePrime")]
    pub three_prime: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_threePrime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub three_prime_ext: Option<FieldExtension>,
    /** **The linkages between sugar residues will also be captured**

 The linkages between sugar residues will also be captured.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "linkage")]
    pub linkage: Vec<Option<SubstanceNucleicAcidSubunitLinkage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_linkage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub linkage_ext: Vec<Option<FieldExtension>>,
    /** **5.3.6.8.1 Sugar ID (Mandatory)**

 5.3.6.8.1 Sugar ID (Mandatory).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sugar")]
    pub sugar: Vec<Option<SubstanceNucleicAcidSubunitSugar>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sugar")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sugar_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceNucleicAcidSubunit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceNucleicAcidSubunitBuilder {
        SubstanceNucleicAcidSubunitBuilder::default()
    }
}
/// Sub-fields of the linkage field in SubstanceNucleicAcidSubunit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceNucleicAcidSubunitLinkageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceNucleicAcidSubunitLinkage {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 entity that links the sugar residues together should also be captured for nearly all naturally occurring nucleic acid the linkage is a phosphate group. For many synthetic oligonucleotides phosphorothioate linkages are often seen. Linkage connectivity is assumed to be 3’-5’. If the linkage is either 3’-3’ or 5’-5’ this should be specified**

 The entity that links the sugar residues together should also be captured for nearly all naturally occurring nucleic acid the linkage is a phosphate group. For many synthetic oligonucleotides phosphorothioate linkages are often seen. Linkage connectivity is assumed to be 3’-5’. If the linkage is either 3’-3’ or 5’-5’ this should be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "connectivity")]
    pub connectivity: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_connectivity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub connectivity_ext: Option<FieldExtension>,
    /** **Each linkage will be registered as a fragment and have an ID**

 Each linkage will be registered as a fragment and have an ID.

 */
    #[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>,
    /** **Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage**

 Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage.

 */
    #[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>,
    /** **Residues shall be captured as described in 5.3.6.8.3**

 Residues shall be captured as described in 5.3.6.8.3.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "residueSite")]
    pub residue_site: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_residueSite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub residue_site_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceNucleicAcidSubunitLinkage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceNucleicAcidSubunitLinkageBuilder {
        SubstanceNucleicAcidSubunitLinkageBuilder::default()
    }
}
/// Sub-fields of the sugar field in SubstanceNucleicAcidSubunit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceNucleicAcidSubunitSugarBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceNucleicAcidSubunitSugar {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Substance ID of the sugar or sugar-like component that make up the nucleotide**

 The Substance ID of the sugar or sugar-like component that make up the nucleotide.

 */
    #[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>,
    /** **The name of the sugar or sugar-like component that make up the nucleotide**

 The name of the sugar or sugar-like component that make up the nucleotide.

 */
    #[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 residues that contain a given sugar will be captured. The order of given residues will be captured in the 5‘-3‘direction consistent with the base sequences listed above**

 The residues that contain a given sugar will be captured. The order of given residues will be captured in the 5‘-3‘direction consistent with the base sequences listed above.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "residueSite")]
    pub residue_site: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_residueSite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub residue_site_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceNucleicAcidSubunitSugar {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceNucleicAcidSubunitSugarBuilder {
        SubstanceNucleicAcidSubunitSugarBuilder::default()
    }
}
/** Properties of a substance specific to it being a polymer.

 **[SubstancePolymer](http://hl7.org/fhir/StructureDefinition/SubstancePolymer) v5.0.0**

 Properties of a substance specific to it being a polymer

 Properties of a substance specific to it being a polymer.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstancePolymer(pub Box<SubstancePolymerInner>);
/** Properties of a substance specific to it being a polymer.

 **[SubstancePolymer](http://hl7.org/fhir/StructureDefinition/SubstancePolymer) v5.0.0**

 Properties of a substance specific to it being a polymer

 Properties of a substance specific to it being a polymer.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstancePolymerInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstancePolymer::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstancePolymer", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 business idenfier for this polymer, but typically this is handled by a SubstanceDefinition identifier**

 A business idenfier for this polymer, but typically this is handled by a SubstanceDefinition 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>,
    /** **Overall type of the polymer**

 Overall type of the polymer.

 */
    #[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>,
    /** **Polymer geometry, e.g. linear, branched, cross-linked, network or dendritic**

 Polymer geometry, e.g. linear, branched, cross-linked, network or dendritic.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "geometry")]
    pub geometry: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_geometry")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub geometry_ext: Option<FieldExtension>,
    /** **Descrtibes the copolymer sequence type (polymer connectivity)**

 Descrtibes the copolymer sequence type (polymer connectivity).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copolymerConnectivity")]
    pub copolymer_connectivity: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_copolymerConnectivity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub copolymer_connectivity_ext: Vec<Option<FieldExtension>>,
    /** **Todo - this is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder**

 Todo - this is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modification")]
    pub modification: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub modification_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "monomerSet")]
    pub monomer_set: Vec<Option<SubstancePolymerMonomerSet>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_monomerSet")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub monomer_set_ext: Vec<Option<FieldExtension>>,
    /** **Specifies and quantifies the repeated units and their configuration**

 Specifies and quantifies the repeated units and their configuration.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repeat")]
    pub repeat: Vec<Option<SubstancePolymerRepeat>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_repeat")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub repeat_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerBuilder {
    #[doc = concat!("Finalize building ", "SubstancePolymer", ".")]
    pub fn build(self) -> Result<SubstancePolymer, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstancePolymerInner> for SubstancePolymer {
    fn from(inner: SubstancePolymerInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstancePolymer {
    type Target = SubstancePolymerInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstancePolymer {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstancePolymer {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstancePolymerBuilder {
        SubstancePolymerBuilder::default()
    }
}
impl SubstancePolymer {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstancePolymer
    }
}
/// Sub-fields of the monomerSet field in SubstancePolymer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerMonomerSetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerMonomerSet {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Captures the type of ratio to the entire polymer, e.g. Monomer/Polymer ratio, SRU/Polymer Ratio**

 Captures the type of ratio to the entire polymer, e.g. Monomer/Polymer ratio, SRU/Polymer Ratio.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ratioType")]
    pub ratio_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ratioType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ratio_type_ext: Option<FieldExtension>,
    /** **The starting materials - monomer(s) used in the synthesis of the polymer**

 The starting materials - monomer(s) used in the synthesis of the polymer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "startingMaterial")]
    pub starting_material: Vec<Option<SubstancePolymerMonomerSetStartingMaterial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_startingMaterial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub starting_material_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerMonomerSet {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerMonomerSetBuilder {
        SubstancePolymerMonomerSetBuilder::default()
    }
}
/// Sub-fields of the startingMaterial field in SubstancePolymerMonomerSet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerMonomerSetStartingMaterialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerMonomerSetStartingMaterial {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of substance for this starting material**

 The type of substance for this starting material.

 */
    #[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>,
    /** **Substance high level category, e.g. chemical substance**

 Substance high level category, e.g. chemical substance.

 */
    #[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>,
    /** **Used to specify whether the attribute described is a defining element for the unique identification of the polymer**

 Used to specify whether the attribute described is a defining element for the unique identification of the polymer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isDefining")]
    pub is_defining: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isDefining")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_defining_ext: Option<FieldExtension>,
    /** **A percentage**

 A percentage.

 */
    #[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 SubstancePolymerMonomerSetStartingMaterial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerMonomerSetStartingMaterialBuilder {
        SubstancePolymerMonomerSetStartingMaterialBuilder::default()
    }
}
/// Sub-fields of the repeat field in SubstancePolymer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerRepeatBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerRepeat {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 representation of an (average) molecular formula from a polymer**

 A representation of an (average) molecular formula from a polymer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "averageMolecularFormula")]
    pub average_molecular_formula: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_averageMolecularFormula")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub average_molecular_formula_ext: Option<FieldExtension>,
    /** **How the quantitative amount of Structural Repeat Units is captured (e.g. Exact, Numeric, Average)**

 How the quantitative amount of Structural Repeat Units is captured (e.g. Exact, Numeric, Average).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repeatUnitAmountType")]
    pub repeat_unit_amount_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_repeatUnitAmountType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub repeat_unit_amount_type_ext: Option<FieldExtension>,
    /** **An SRU - Structural Repeat Unit**

 An SRU - Structural Repeat Unit.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repeatUnit")]
    pub repeat_unit: Vec<Option<SubstancePolymerRepeatRepeatUnit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_repeatUnit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub repeat_unit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerRepeat {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerRepeatBuilder {
        SubstancePolymerRepeatBuilder::default()
    }
}
/// Sub-fields of the repeatUnit field in SubstancePolymerRepeat
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerRepeatRepeatUnitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerRepeatRepeatUnit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Structural repeat units are essential elements for defining polymers**

 Structural repeat units are essential elements for defining polymers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unit")]
    pub unit: Option<String>,
    /// 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>,
    /** **The orientation of the polymerisation, e.g. head-tail, head-head, random**

 The orientation of the polymerisation, e.g. head-tail, head-head, random.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orientation")]
    pub orientation: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orientation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub orientation_ext: Option<FieldExtension>,
    /** **Number of repeats of this unit**

 Number of repeats of this unit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<i32>,
    /// 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>,
    /** **Applies to homopolymer and block co-polymers where the degree of polymerisation within a block can be described**

 Applies to homopolymer and block co-polymers where the degree of polymerisation within a block can be described.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "degreeOfPolymerisation")]
    pub degree_of_polymerisation: Vec<
        Option<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_degreeOfPolymerisation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub degree_of_polymerisation_ext: Vec<Option<FieldExtension>>,
    /** **A graphical structure for this SRU**

 A graphical structure for this SRU.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "structuralRepresentation")]
    pub structural_representation: Vec<
        Option<SubstancePolymerRepeatRepeatUnitStructuralRepresentation>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_structuralRepresentation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub structural_representation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerRepeatRepeatUnit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerRepeatRepeatUnitBuilder {
        SubstancePolymerRepeatRepeatUnitBuilder::default()
    }
}
/// Sub-fields of the degreeOfPolymerisation field in SubstancePolymerRepeatRepeatUnit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of the degree of polymerisation shall be described, e.g. SRU/Polymer Ratio**

 The type of the degree of polymerisation shall be described, e.g. SRU/Polymer Ratio.

 */
    #[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>,
    /** **An average amount of polymerisation**

 An average amount of polymerisation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "average")]
    pub average: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_average")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub average_ext: Option<FieldExtension>,
    /** **A low expected limit of the amount**

 A low expected limit of the amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "low")]
    pub low: Option<i32>,
    /// 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>,
    /** **A high expected limit of the amount**

 A high expected limit of the amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "high")]
    pub high: Option<i32>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationBuilder {
        SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationBuilder::default()
    }
}
/// Sub-fields of the structuralRepresentation field in SubstancePolymerRepeatRepeatUnit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstancePolymerRepeatRepeatUnitStructuralRepresentationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstancePolymerRepeatRepeatUnitStructuralRepresentation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of structure (e.g. Full, Partial, Representative)**

 The type of structure (e.g. Full, Partial, Representative).

 */
    #[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 structural representation as text string in a standard format e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF**

 The structural representation as text string in a standard format e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "representation")]
    pub representation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_representation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub representation_ext: Option<FieldExtension>,
    /** **The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF**

 The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "format")]
    pub format: Option<CodeableConcept>,
    /// 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>,
    /** **An attached file with the structural representation**

 An attached file with the structural representation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attachment")]
    pub attachment: Option<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>,
}
#[cfg(feature = "builders")]
impl SubstancePolymerRepeatRepeatUnitStructuralRepresentation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstancePolymerRepeatRepeatUnitStructuralRepresentationBuilder {
        SubstancePolymerRepeatRepeatUnitStructuralRepresentationBuilder::default()
    }
}
/** A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.

 **[SubstanceProtein](http://hl7.org/fhir/StructureDefinition/SubstanceProtein) v5.0.0**

 A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators

 A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstanceProtein(pub Box<SubstanceProteinInner>);
/** A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.

 **[SubstanceProtein](http://hl7.org/fhir/StructureDefinition/SubstanceProtein) v5.0.0**

 A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators

 A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceProteinBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceProteinInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstanceProtein::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstanceProtein", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence**

 The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceType")]
    pub sequence_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_type_ext: Option<FieldExtension>,
    /** **Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable**

 Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfSubunits")]
    pub number_of_subunits: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfSubunits")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_subunits_ext: Option<FieldExtension>,
    /** **The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions**

 The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disulfideLinkage")]
    pub disulfide_linkage: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_disulfideLinkage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub disulfide_linkage_ext: Vec<Option<FieldExtension>>,
    /** **This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times**

 This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subunit")]
    pub subunit: Vec<Option<SubstanceProteinSubunit>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subunit")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subunit_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceProteinBuilder {
    #[doc = concat!("Finalize building ", "SubstanceProtein", ".")]
    pub fn build(self) -> Result<SubstanceProtein, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceProteinInner> for SubstanceProtein {
    fn from(inner: SubstanceProteinInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstanceProtein {
    type Target = SubstanceProteinInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstanceProtein {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstanceProtein {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceProteinBuilder {
        SubstanceProteinBuilder::default()
    }
}
impl SubstanceProtein {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstanceProtein
    }
}
/// Sub-fields of the subunit field in SubstanceProtein
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceProteinSubunitBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceProteinSubunit {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts**

 Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subunit")]
    pub subunit: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subunit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subunit_ext: Option<FieldExtension>,
    /** **The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence**

 The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.

 */
    #[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>,
    /** **Length of linear sequences of amino acids contained in the subunit**

 Length of linear sequences of amino acids contained in the subunit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "length")]
    pub length: Option<i32>,
    /// 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>,
    /** **The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence**

 The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceAttachment")]
    pub sequence_attachment: Option<Attachment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceAttachment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_attachment_ext: Option<FieldExtension>,
    /** **Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID**

 Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nTerminalModificationId")]
    pub n_terminal_modification_id: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nTerminalModificationId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub n_terminal_modification_id_ext: Option<FieldExtension>,
    /** **The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified**

 The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nTerminalModification")]
    pub n_terminal_modification: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nTerminalModification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub n_terminal_modification_ext: Option<FieldExtension>,
    /** **Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID**

 Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cTerminalModificationId")]
    pub c_terminal_modification_id: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cTerminalModificationId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub c_terminal_modification_id_ext: Option<FieldExtension>,
    /** **The modification at the C-terminal shall be specified**

 The modification at the C-terminal shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cTerminalModification")]
    pub c_terminal_modification: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cTerminalModification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub c_terminal_modification_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceProteinSubunit {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceProteinSubunitBuilder {
        SubstanceProteinSubunitBuilder::default()
    }
}
/** Todo.

 **[SubstanceReferenceInformation](http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation) v5.0.0**

 Todo

 Todo.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstanceReferenceInformation(pub Box<SubstanceReferenceInformationInner>);
/** Todo.

 **[SubstanceReferenceInformation](http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation) v5.0.0**

 Todo

 Todo.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceReferenceInformationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceReferenceInformationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstanceReferenceInformation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstanceReferenceInformation", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Todo**

 Todo.

 */
    #[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>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gene")]
    pub gene: Vec<Option<SubstanceReferenceInformationGene>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_gene")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub gene_ext: Vec<Option<FieldExtension>>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "geneElement")]
    pub gene_element: Vec<Option<SubstanceReferenceInformationGeneElement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_geneElement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub gene_element_ext: Vec<Option<FieldExtension>>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<SubstanceReferenceInformationTarget>>,
    /// 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 SubstanceReferenceInformationBuilder {
    #[doc = concat!("Finalize building ", "SubstanceReferenceInformation", ".")]
    pub fn build(
        self,
    ) -> Result<SubstanceReferenceInformation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceReferenceInformationInner> for SubstanceReferenceInformation {
    fn from(inner: SubstanceReferenceInformationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstanceReferenceInformation {
    type Target = SubstanceReferenceInformationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstanceReferenceInformation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstanceReferenceInformation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceReferenceInformationBuilder {
        SubstanceReferenceInformationBuilder::default()
    }
}
impl SubstanceReferenceInformation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstanceReferenceInformation
    }
}
/// Sub-fields of the gene field in SubstanceReferenceInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceReferenceInformationGeneBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceReferenceInformationGene {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "geneSequenceOrigin")]
    pub gene_sequence_origin: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_geneSequenceOrigin")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gene_sequence_origin_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gene")]
    pub gene: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gene")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gene_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceReferenceInformationGene {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceReferenceInformationGeneBuilder {
        SubstanceReferenceInformationGeneBuilder::default()
    }
}
/// Sub-fields of the geneElement field in SubstanceReferenceInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceReferenceInformationGeneElementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceReferenceInformationGeneElement {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Todo**

 Todo.

 */
    #[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>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "element")]
    pub element: Option<Identifier>,
    /// 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>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceReferenceInformationGeneElement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceReferenceInformationGeneElementBuilder {
        SubstanceReferenceInformationGeneElementBuilder::default()
    }
}
/// Sub-fields of the target field in SubstanceReferenceInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceReferenceInformationTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceReferenceInformationTarget {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<Identifier>,
    /// 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>,
    /** **Todo**

 Todo.

 */
    #[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>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interaction")]
    pub interaction: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_interaction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub interaction_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organism")]
    pub organism: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organism")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organismType")]
    pub organism_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organismType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_type_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub amount: Option<SubstanceReferenceInformationTargetAmount>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<SubstanceReferenceInformationTargetAmountExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amountType")]
    pub amount_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amountType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_type_ext: Option<FieldExtension>,
    /** **Todo**

 Todo.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Vec<Option<Reference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl SubstanceReferenceInformationTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceReferenceInformationTargetBuilder {
        SubstanceReferenceInformationTargetBuilder::default()
    }
}
/// Choice of types for the amount[x] field in SubstanceReferenceInformationTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceReferenceInformationTargetAmount {
    /// Variant accepting the Quantity type.
    #[serde(rename = "amountQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "amountRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "amountString")]
    String(String),
}
/// Extension value for SubstanceReferenceInformationTargetAmount.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceReferenceInformationTargetAmountExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_amountQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_amountRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_amountString")]
    String(FieldExtension),
}
/** Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.

 **[SubstanceSourceMaterial](http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial) v5.0.0**

 Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex

 Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubstanceSourceMaterial(pub Box<SubstanceSourceMaterialInner>);
/** Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.

 **[SubstanceSourceMaterial](http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial) v5.0.0**

 Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex

 Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceSourceMaterialInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SubstanceSourceMaterial::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SubstanceSourceMaterial", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **General high level classification of the source material specific to the origin of the material**

 General high level classification of the source material specific to the origin of the material.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceMaterialClass")]
    pub source_material_class: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceMaterialClass")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_material_class_ext: Option<FieldExtension>,
    /** **The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent**

 The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceMaterialType")]
    pub source_material_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceMaterialType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_material_type_ext: Option<FieldExtension>,
    /** **The state of the source material when extracted**

 The state of the source material when extracted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceMaterialState")]
    pub source_material_state: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceMaterialState")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_material_state_ext: Option<FieldExtension>,
    /** **The unique identifier associated with the source material parent organism shall be specified**

 The unique identifier associated with the source material parent organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organismId")]
    pub organism_id: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organismId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_id_ext: Option<FieldExtension>,
    /** **The organism accepted Scientific name shall be provided based on the organism taxonomy**

 The organism accepted Scientific name shall be provided based on the organism taxonomy.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organismName")]
    pub organism_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organismName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_name_ext: Option<FieldExtension>,
    /** **The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant)**

 The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parentSubstanceId")]
    pub parent_substance_id: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parentSubstanceId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parent_substance_id_ext: Vec<Option<FieldExtension>>,
    /** **The parent substance of the Herbal Drug, or Herbal preparation**

 The parent substance of the Herbal Drug, or Herbal preparation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parentSubstanceName")]
    pub parent_substance_name: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parentSubstanceName")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parent_substance_name_ext: Vec<Option<FieldExtension>>,
    /** **The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate**

 The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "countryOfOrigin")]
    pub country_of_origin: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_countryOfOrigin")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub country_of_origin_ext: Vec<Option<FieldExtension>>,
    /** **The place/region where the plant is harvested or the places/regions where the animal source material has its habitat**

 The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "geographicalLocation")]
    pub geographical_location: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_geographicalLocation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub geographical_location_ext: Vec<Option<FieldExtension>>,
    /** **Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum)**

 Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "developmentStage")]
    pub development_stage: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_developmentStage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub development_stage_ext: Option<FieldExtension>,
    /** **Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels**

 Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fractionDescription")]
    pub fraction_description: Vec<Option<SubstanceSourceMaterialFractionDescription>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fractionDescription")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fraction_description_ext: Vec<Option<FieldExtension>>,
    /** **This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf**

 This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organism")]
    pub organism: Option<SubstanceSourceMaterialOrganism>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organism")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_ext: Option<FieldExtension>,
    /** **To do**

 To do.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partDescription")]
    pub part_description: Vec<Option<SubstanceSourceMaterialPartDescription>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partDescription")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_description_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialBuilder {
    #[doc = concat!("Finalize building ", "SubstanceSourceMaterial", ".")]
    pub fn build(self) -> Result<SubstanceSourceMaterial, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceSourceMaterialInner> for SubstanceSourceMaterial {
    fn from(inner: SubstanceSourceMaterialInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SubstanceSourceMaterial {
    type Target = SubstanceSourceMaterialInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SubstanceSourceMaterial {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SubstanceSourceMaterial {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialBuilder {
        SubstanceSourceMaterialBuilder::default()
    }
}
impl SubstanceSourceMaterial {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SubstanceSourceMaterial
    }
}
/// Sub-fields of the fractionDescription field in SubstanceSourceMaterial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialFractionDescriptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialFractionDescription {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **This element is capturing information about the fraction of a plant part, or human plasma for fractionation**

 This element is capturing information about the fraction of a plant part, or human plasma for fractionation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fraction")]
    pub fraction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fraction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fraction_ext: Option<FieldExtension>,
    /** **The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1**

 The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "materialType")]
    pub material_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_materialType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub material_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialFractionDescription {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialFractionDescriptionBuilder {
        SubstanceSourceMaterialFractionDescriptionBuilder::default()
    }
}
/// Sub-fields of the organism field in SubstanceSourceMaterial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialOrganismBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialOrganism {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 family of an organism shall be specified**

 The family of an organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "family")]
    pub family: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_family")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub family_ext: Option<FieldExtension>,
    /** **The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies**

 The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genus")]
    pub genus: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_genus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub genus_ext: Option<FieldExtension>,
    /** **The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies**

 The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "species")]
    pub species: Option<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>,
    /** **The Intraspecific type of an organism shall be specified**

 The Intraspecific type of an organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intraspecificType")]
    pub intraspecific_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intraspecificType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intraspecific_type_ext: Option<FieldExtension>,
    /** **The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention**

 The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "intraspecificDescription")]
    pub intraspecific_description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intraspecificDescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intraspecific_description_ext: Option<FieldExtension>,
    /** **4.9.13.6.1 Author type (Conditional)**

 4.9.13.6.1 Author type (Conditional).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<SubstanceSourceMaterialOrganismAuthor>>,
    /// 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>>,
    /** **4.9.13.8.1 Hybrid species maternal organism ID (Optional)**

 4.9.13.8.1 Hybrid species maternal organism ID (Optional).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hybrid")]
    pub hybrid: Option<SubstanceSourceMaterialOrganismHybrid>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hybrid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hybrid_ext: Option<FieldExtension>,
    /** **4.9.13.7.1 Kingdom (Conditional)**

 4.9.13.7.1 Kingdom (Conditional).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organismGeneral")]
    pub organism_general: Option<SubstanceSourceMaterialOrganismOrganismGeneral>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organismGeneral")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organism_general_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialOrganism {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialOrganismBuilder {
        SubstanceSourceMaterialOrganismBuilder::default()
    }
}
/// Sub-fields of the author field in SubstanceSourceMaterialOrganism
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialOrganismAuthorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialOrganismAuthor {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name**

 The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorType")]
    pub author_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authorType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_type_ext: Option<FieldExtension>,
    /** **The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank)**

 The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorDescription")]
    pub author_description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authorDescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_description_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialOrganismAuthor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialOrganismAuthorBuilder {
        SubstanceSourceMaterialOrganismAuthorBuilder::default()
    }
}
/// Sub-fields of the hybrid field in SubstanceSourceMaterialOrganism
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialOrganismHybridBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialOrganismHybrid {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal**

 The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maternalOrganismId")]
    pub maternal_organism_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maternalOrganismId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub maternal_organism_id_ext: Option<FieldExtension>,
    /** **The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal**

 The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maternalOrganismName")]
    pub maternal_organism_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maternalOrganismName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub maternal_organism_name_ext: Option<FieldExtension>,
    /** **The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary**

 The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paternalOrganismId")]
    pub paternal_organism_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paternalOrganismId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub paternal_organism_id_ext: Option<FieldExtension>,
    /** **The name of the paternal species constituting the hybrid organism shall be specified**

 The name of the paternal species constituting the hybrid organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paternalOrganismName")]
    pub paternal_organism_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paternalOrganismName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub paternal_organism_name_ext: Option<FieldExtension>,
    /** **The hybrid type of an organism shall be specified**

 The hybrid type of an organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hybridType")]
    pub hybrid_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hybridType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hybrid_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialOrganismHybrid {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialOrganismHybridBuilder {
        SubstanceSourceMaterialOrganismHybridBuilder::default()
    }
}
/// Sub-fields of the organismGeneral field in SubstanceSourceMaterialOrganism
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialOrganismOrganismGeneralBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialOrganismOrganismGeneral {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 kingdom of an organism shall be specified**

 The kingdom of an organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "kingdom")]
    pub kingdom: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kingdom")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kingdom_ext: Option<FieldExtension>,
    /** **The phylum of an organism shall be specified**

 The phylum of an organism shall be specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "phylum")]
    pub phylum: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_phylum")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub phylum_ext: Option<FieldExtension>,
    /** **The class of an organism shall be specified**

 The class of an organism shall be specified.

 */
    #[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>,
    /** **The order of an organism shall be specified,**

 The order of an organism shall be specified,.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "order")]
    pub order: Option<CodeableConcept>,
    /// 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>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialOrganismOrganismGeneral {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialOrganismOrganismGeneralBuilder {
        SubstanceSourceMaterialOrganismOrganismGeneralBuilder::default()
    }
}
/// Sub-fields of the partDescription field in SubstanceSourceMaterial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceSourceMaterialPartDescriptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceSourceMaterialPartDescription {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Entity of anatomical origin of source material within an organism**

 Entity of anatomical origin of source material within an organism.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_ext: Option<FieldExtension>,
    /** **The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply**

 The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partLocation")]
    pub part_location: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partLocation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_location_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceSourceMaterialPartDescription {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceSourceMaterialPartDescriptionBuilder {
        SubstanceSourceMaterialPartDescriptionBuilder::default()
    }
}
/** Record of delivery of what is supplied.

 **[SupplyDelivery](http://hl7.org/fhir/StructureDefinition/SupplyDelivery) v5.0.0**

 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>);
/** Record of delivery of what is supplied.

 **[SupplyDelivery](http://hl7.org/fhir/StructureDefinition/SupplyDelivery) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 supply delivery event that is used to identify it across multiple disparate systems.

 This identifier is typically assigned by the supplier, and may be used to reference the delivery when exchanging information about it with 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>>,
    /** **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>,
    /** **[SupplyDeliverySupplyItemType](http://hl7.org/fhir/ValueSet/supplydelivery-supplyitemtype); Category of supply event**

 Indicates the type of supply being provided.  Examples include: Medication, Device, Biologically Derived Product.

 */
    #[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 = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "suppliedItem")]
    pub supplied_item: Vec<Option<SupplyDeliverySuppliedItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_suppliedItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supplied_item_ext: Vec<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>,
    /** **The item supplier**

 The individual or organization responsible for supplying the delivery.

 */
    #[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 delivery was sent**

 Identification of the facility/location where the delivery was shipped to.

 */
    #[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 received the delivery**

 Identifies the individual or organization that received the delivery.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 supplied**

 The amount of the item that has been supplied.  Unit of measure may be included.

 */
    #[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, Device or Biologically Derived Product supplied**

 Identifies the medication, substance, device or biologically derived product being 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.

 */
    #[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),
}
/** A record of a non-patient specific request for a medication, substance, device, certain types of biologically derived product, and nutrition product used in the healthcare setting.

 **[SupplyRequest](http://hl7.org/fhir/StructureDefinition/SupplyRequest) v5.0.0**

 Request for a medication, substance or device

 A record of a request to deliver a medication, substance or device used in the healthcare setting to a particular destination for a particular person or organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SupplyRequest(pub Box<SupplyRequestInner>);
/** A record of a non-patient specific request for a medication, substance, device, certain types of biologically derived product, and nutrition product used in the healthcare setting.

 **[SupplyRequest](http://hl7.org/fhir/StructureDefinition/SupplyRequest) v5.0.0**

 Request for a medication, substance or device

 A record of a request to deliver a medication, substance or device used in the healthcare setting to a particular destination for a particular person or 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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 SupplyRequest**

 Business identifiers assigned to this SupplyRequest by the author and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.

 The identifier.type element is used to distinguish between the identifiers assigned by the requester/placer and the performer/filler. */
    #[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>>,
    /** **[SupplyRequestStatus](http://hl7.org/fhir/ValueSet/supplyrequest-status); draft | active | suspended +**

 Status of the supply request.

 */
    #[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>,
    /** **What other request is fulfilled by this supply request**

 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>>,
    /** **[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 patient for who the supply request is for**

 The patient to whom the supply will be given or for whom they will be used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deliverFor")]
    pub deliver_for: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_deliverFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deliver_for_ext: Option<FieldExtension>,
    /** **[SupplyRequestItem](http://hl7.org/fhir/ValueSet/supply-item); 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(rename = "item")]
    pub item: CodeableReference,
    /// 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>,
    /** **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>,
    /** **Ordered item details**

 Specific parameters for the ordered item.  For example, the size of the indicated item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<SupplyRequestParameter>>,
    /// 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>>,
    /** **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>,
    /** **Individual making the request**

 The device, practitioner, etc. who initiated the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<Reference>,
    /// 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>>,
    /** **[SupplyRequestReason](http://hl7.org/fhir/ValueSet/supplyrequest-reason); The reason why the supply item was requested**

 The reason why the supply item was requested.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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 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 parameter 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 = "SupplyRequestParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SupplyRequestParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ParameterCode](); Item detail**

 A code or string that identifies the device detail being asserted.

 */
    #[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>,
    /** **Value of detail**

 The value of the device detail.

 Range means device should have a value that falls somewhere within the specified range. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<SupplyRequestParameterValue>,
    /// 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<SupplyRequestParameterValueExtension>,
}
#[cfg(feature = "builders")]
impl SupplyRequestParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SupplyRequestParameterBuilder {
        SupplyRequestParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in SupplyRequestParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestParameterValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
}
/// Extension value for SupplyRequestParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestParameterValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(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),
}
/** A task to be performed.

 **[Task](http://hl7.org/fhir/StructureDefinition/Task) v5.0.0**

 A task to be performed

 A task to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Task(pub Box<TaskInner>);
/** A task to be performed.

 **[Task](http://hl7.org/fhir/StructureDefinition/Task) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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**

 The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_canonical_ext: Option<FieldExtension>,
    /** **Formal definition of task**

 The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_uri_ext: Option<FieldExtension>,
    /** **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 ServiceRequest, MedicationRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfill.  This latter resource is referenced by focus.  For example, based on a CarePlan (= basedOn), a task is created to fulfill a ServiceRequest ( = focus ) to collect a specimen from a patient.

 Task.basedOn is never the same as Task.focus.  Task.basedOn will typically not be present for 'please fulfill' Tasks as a distinct authorization is rarely needed to request fulfillment.  If the Task is seeking fulfillment of an order, the order to be fulfilled is always communicated using `focus`, never basedOn.  However, authorization may be needed to perform other types of Task actions.  As an example of when both would be present, a Task seeking suspension of a prescription might have a Task.basedOn pointing to the ServiceRequest ordering surgery (which is the driver for suspending the MedicationRequest - which would be the Task.focus). */
    #[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**

 A shared identifier common to multiple independent Task and Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 */
    #[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](http://hl7.org/fhir/ValueSet/task-status-reason); 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<CodeableReference>,
    /// 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/task-intent); unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs 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::TaskIntent,
    /// 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); routine | 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>,
    /** **True if Task is prohibiting action**

 If true indicates that the Task is asking for the specified action to *not* occur.

 The attributes provided with the Task qualify what is not to be done. For example, if a requestedPeriod is provided, the 'do not' request only applies within the specified time. If a requestedPerformer is specified then the 'do not' request only applies to performers of that type. Qualifiers include: code, subject, occurrence, requestedPerformer and performer.

In some cases, the Request.code may pre-coordinate prohibition into the requested action. E.g. 'NPO' (nothing by mouth), 'DNR' (do not recussitate). If this happens, doNotPerform SHALL NOT be set to true. I.e. The resource shall not have double negation. (E.g. 'Do not DNR').

doNotPerform should ONLY be used with Tasks that are tightly bounded in time or process phase.  E.g. 'Do not fulfill the midnight dose of medication X tonight due to the early morning scheduled procedure, where the nurse could reasonably check off 'Med X not given at midnight as instructed'.  Similarly, a decision support proposal that a patient should not be given a standard intake questionnaire (because the patient is cognitively impaired) would be marked as 'complete' or 'rejected' when the clinician preps the CarePlan or order set after reviewing the decision support results.  If there is a need to create a standing order to not do something that can't be satisfied by a single 'non-action', but rather an ongoing refusal to perform the function, MedicationRequest, ServiceRequest or some other form of authorization should be used. */
    #[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>,
    /** **[TaskCode](http://hl7.org/fhir/ValueSet/task-code); 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 fulfilled or the resource being manipulated (changed, suspended, etc.) 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 = "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 task should be performed**

 Indicates the start and/or end of the period of time when completion of the task is desired to take place.

 This is typically used when the Task is *not* seeking fulfillment of a focus Request, as in that case the period would be specified on the Request and/or in the Task.restriction.period.  Instead, it is used for stand-alone tasks. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestedPeriod")]
    pub requested_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestedPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requested_period_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<Reference>,
    /// 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/performer-role); Who should perform Task**

 The kind of participant or specific participant that should perform the task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestedPerformer")]
    pub requested_performer: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requestedPerformer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requested_performer_ext: Vec<Option<FieldExtension>>,
    /** **Responsible individual**

 Party responsible for managing 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>,
    /** **Who or what performed the task**

 The entity who performed the requested task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<TaskPerformer>>,
    /// 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 task occurs**

 Principal physical location where this task is performed.

 This should only be specified when the Task to be/being performed happens or is expected to happen primarily within the bounds of a single Location.  Other locations (e.g. source, destination, etc.) would either be reflected on the 'basedOn' Request or be conveyed as distinct Task.input values. */
    #[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>,
    /** **[TaskReason](); Why task is needed**

 A description, code, or reference indicating why this task needs to be performed.

 This will typically not be present for Tasks with a code of 'please fulfill' as, for those, the reason for action is conveyed on the Request pointed to by Task.focus.  Some types of tasks will not need a 'reason'.  E.g. a request to discharge a patient can be inferred to be 'because the patient is ready' and this would not need a reason to be stated on the Task. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableReference>>,
    /// 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>>,
    /** **Associated insurance coverage**

 Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<Reference>>,
    /// 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>>,
    /** **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.

 Task.restriction can only be present if the Task is seeking fulfillment of another Request resource, and the restriction identifies what subset of the authorization conveyed by the request is supposed to be fulfilled by this Task. A possible example could be a standing order (the request) covering a significant time period and/or individuals, while the Task seeks fulfillment for only a subset of that time-period and a single individual. */
    #[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
    }
}
/// Sub-fields of the performer 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 = "TaskPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TaskPerformer {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TaskPerformerFunctionCode](); Type of performance**

 A code or description of the performer of the task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "function")]
    pub function: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_function")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub function_ext: Option<FieldExtension>,
    /** **Who performed the task**

 The actor or entity who performed the task.

 */
    #[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 TaskPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TaskPerformerBuilder {
        TaskPerformerBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 is sought**

 The time-period for which fulfillment is sought. This must fall within the overall time period authorized in the referenced request.  E.g. ServiceRequest.occurance[x].

 This is distinct from Task.executionPeriod. ExecutionPeriod indicates when the task needs to be initiated, while Task.restriction.period specifies the subset of the overall authorization that this period covers. For example, a MedicationRequest with an overall effective period of 1 year might have a Task whose restriction.period is 2 months (i.e. satisfy 2 months of medication therapy), while the execution period might be 'between now and 5 days from now' - i.e. If you say yes to this, then you're agreeing to supply medication for that 2 month period within the next 5 days.

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 one potential recipient/target, to identify who is fulfillment is sought for.

 */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
    /// 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 Integer64 type.
    #[serde(rename = "valueInteger64")]
    Integer64(Integer64),
    /// 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 Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the Uuid type.
    #[serde(rename = "valueUuid")]
    Uuid(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 CodeableReference type.
    #[serde(rename = "valueCodeableReference")]
    CodeableReference(CodeableReference),
    /// 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 RatioRange type.
    #[serde(rename = "valueRatioRange")]
    RatioRange(RatioRange),
    /// 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 ContactDetail type.
    #[serde(rename = "valueContactDetail")]
    ContactDetail(ContactDetail),
    /// Variant accepting the DataRequirement type.
    #[serde(rename = "valueDataRequirement")]
    DataRequirement(DataRequirement),
    /// Variant accepting the Expression type.
    #[serde(rename = "valueExpression")]
    Expression(Expression),
    /// Variant accepting the ParameterDefinition type.
    #[serde(rename = "valueParameterDefinition")]
    ParameterDefinition(ParameterDefinition),
    /// Variant accepting the RelatedArtifact type.
    #[serde(rename = "valueRelatedArtifact")]
    RelatedArtifact(RelatedArtifact),
    /// Variant accepting the TriggerDefinition type.
    #[serde(rename = "valueTriggerDefinition")]
    TriggerDefinition(TriggerDefinition),
    /// Variant accepting the UsageContext type.
    #[serde(rename = "valueUsageContext")]
    UsageContext(UsageContext),
    /// Variant accepting the Availability type.
    #[serde(rename = "valueAvailability")]
    Availability(Availability),
    /// Variant accepting the ExtendedContactDetail type.
    #[serde(rename = "valueExtendedContactDetail")]
    ExtendedContactDetail(ExtendedContactDetail),
    /// Variant accepting the Dosage type.
    #[serde(rename = "valueDosage")]
    Dosage(Dosage),
    /// 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 Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(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 Integer64 extension.
    #[serde(rename = "_valueInteger64")]
    Integer64(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 Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the Uuid extension.
    #[serde(rename = "_valueUuid")]
    Uuid(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 CodeableReference extension.
    #[serde(rename = "_valueCodeableReference")]
    CodeableReference(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 RatioRange extension.
    #[serde(rename = "_valueRatioRange")]
    RatioRange(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 ContactDetail extension.
    #[serde(rename = "_valueContactDetail")]
    ContactDetail(FieldExtension),
    /// Variant accepting the DataRequirement extension.
    #[serde(rename = "_valueDataRequirement")]
    DataRequirement(FieldExtension),
    /// Variant accepting the Expression extension.
    #[serde(rename = "_valueExpression")]
    Expression(FieldExtension),
    /// Variant accepting the ParameterDefinition extension.
    #[serde(rename = "_valueParameterDefinition")]
    ParameterDefinition(FieldExtension),
    /// Variant accepting the RelatedArtifact extension.
    #[serde(rename = "_valueRelatedArtifact")]
    RelatedArtifact(FieldExtension),
    /// Variant accepting the TriggerDefinition extension.
    #[serde(rename = "_valueTriggerDefinition")]
    TriggerDefinition(FieldExtension),
    /// Variant accepting the UsageContext extension.
    #[serde(rename = "_valueUsageContext")]
    UsageContext(FieldExtension),
    /// Variant accepting the Availability extension.
    #[serde(rename = "_valueAvailability")]
    Availability(FieldExtension),
    /// Variant accepting the ExtendedContactDetail extension.
    #[serde(rename = "_valueExtendedContactDetail")]
    ExtendedContactDetail(FieldExtension),
    /// Variant accepting the Dosage extension.
    #[serde(rename = "_valueDosage")]
    Dosage(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
    /// 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 Integer64 type.
    #[serde(rename = "valueInteger64")]
    Integer64(Integer64),
    /// 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 Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the Uuid type.
    #[serde(rename = "valueUuid")]
    Uuid(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 CodeableReference type.
    #[serde(rename = "valueCodeableReference")]
    CodeableReference(CodeableReference),
    /// 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 RatioRange type.
    #[serde(rename = "valueRatioRange")]
    RatioRange(RatioRange),
    /// 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 ContactDetail type.
    #[serde(rename = "valueContactDetail")]
    ContactDetail(ContactDetail),
    /// Variant accepting the DataRequirement type.
    #[serde(rename = "valueDataRequirement")]
    DataRequirement(DataRequirement),
    /// Variant accepting the Expression type.
    #[serde(rename = "valueExpression")]
    Expression(Expression),
    /// Variant accepting the ParameterDefinition type.
    #[serde(rename = "valueParameterDefinition")]
    ParameterDefinition(ParameterDefinition),
    /// Variant accepting the RelatedArtifact type.
    #[serde(rename = "valueRelatedArtifact")]
    RelatedArtifact(RelatedArtifact),
    /// Variant accepting the TriggerDefinition type.
    #[serde(rename = "valueTriggerDefinition")]
    TriggerDefinition(TriggerDefinition),
    /// Variant accepting the UsageContext type.
    #[serde(rename = "valueUsageContext")]
    UsageContext(UsageContext),
    /// Variant accepting the Availability type.
    #[serde(rename = "valueAvailability")]
    Availability(Availability),
    /// Variant accepting the ExtendedContactDetail type.
    #[serde(rename = "valueExtendedContactDetail")]
    ExtendedContactDetail(ExtendedContactDetail),
    /// Variant accepting the Dosage type.
    #[serde(rename = "valueDosage")]
    Dosage(Dosage),
    /// 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 Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(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 Integer64 extension.
    #[serde(rename = "_valueInteger64")]
    Integer64(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 Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the Uuid extension.
    #[serde(rename = "_valueUuid")]
    Uuid(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 CodeableReference extension.
    #[serde(rename = "_valueCodeableReference")]
    CodeableReference(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 RatioRange extension.
    #[serde(rename = "_valueRatioRange")]
    RatioRange(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 ContactDetail extension.
    #[serde(rename = "_valueContactDetail")]
    ContactDetail(FieldExtension),
    /// Variant accepting the DataRequirement extension.
    #[serde(rename = "_valueDataRequirement")]
    DataRequirement(FieldExtension),
    /// Variant accepting the Expression extension.
    #[serde(rename = "_valueExpression")]
    Expression(FieldExtension),
    /// Variant accepting the ParameterDefinition extension.
    #[serde(rename = "_valueParameterDefinition")]
    ParameterDefinition(FieldExtension),
    /// Variant accepting the RelatedArtifact extension.
    #[serde(rename = "_valueRelatedArtifact")]
    RelatedArtifact(FieldExtension),
    /// Variant accepting the TriggerDefinition extension.
    #[serde(rename = "_valueTriggerDefinition")]
    TriggerDefinition(FieldExtension),
    /// Variant accepting the UsageContext extension.
    #[serde(rename = "_valueUsageContext")]
    UsageContext(FieldExtension),
    /// Variant accepting the Availability extension.
    #[serde(rename = "_valueAvailability")]
    Availability(FieldExtension),
    /// Variant accepting the ExtendedContactDetail extension.
    #[serde(rename = "_valueExtendedContactDetail")]
    ExtendedContactDetail(FieldExtension),
    /// Variant accepting the Dosage extension.
    #[serde(rename = "_valueDosage")]
    Dosage(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/** A TerminologyCapabilities resource documents a set of capabilities (behaviors) of a FHIR Terminology Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 **[TerminologyCapabilities](http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities) v5.0.0**

 A statement of system capabilities

 A TerminologyCapabilities resource documents a set of capabilities (behaviors) of a FHIR Terminology 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 TerminologyCapabilities(pub Box<TerminologyCapabilitiesInner>);
/** A TerminologyCapabilities resource documents a set of capabilities (behaviors) of a FHIR Terminology Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 **[TerminologyCapabilities](http://hl7.org/fhir/StructureDefinition/TerminologyCapabilities) v5.0.0**

 A statement of system capabilities

 A TerminologyCapabilities resource documents a set of capabilities (behaviors) of a FHIR Terminology 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 = "TerminologyCapabilitiesBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TerminologyCapabilitiesInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "TerminologyCapabilities::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::TerminologyCapabilities", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this terminology capabilities, represented as a URI (globally unique)**

 An absolute URI that is used to identify this terminology capabilities when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this terminology capabilities is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the terminology capabilities is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 terminology capabilities**

 A formal identifier that is used to identify this terminology capabilities 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, and can then identify this terminology capabilities 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 terminology capabilities**

 The identifier that is used to identify this version of the terminology capabilities when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the terminology capabilities 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 terminology capabilities instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the terminology capabilities with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<TerminologyCapabilitiesVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<TerminologyCapabilitiesVersionAlgorithmExtension>,
    /** **Name for this terminology capabilities (computer friendly)**

 A natural language name identifying the terminology capabilities. 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 alphanumeric type name to ensure that it is machine-processing 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 terminology capabilities (human friendly)**

 A short, descriptive, user-friendly title for the terminology capabilities.

 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 terminology capabilities. Enables tracking the life-cycle of the content.

 Allows filtering of terminology capabilitiess that are appropriate for use versus not.This is not intended for use with actual capability statements, but where capability statements are used to describe possible or desired systems.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 terminology capabilities is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of terminology capabilitiess that are appropriate for use versus not. */
    #[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 last changed**

 The date  (and optionally time) when the terminology capabilities was last significantly changed. The date must change 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 terminology capabilities changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the terminology capabilities. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the terminology capabilities.

 Usually an organization but may be an individual. The publisher (or steward) of the terminology capabilities is the organization or individual primarily responsible for the maintenance and upkeep of the terminology capabilities. 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 terminology capabilities. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 terminology capabilities**

 A free text natural language description of the terminology capabilities 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 comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the terminology capabilities 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 terminology capabilities is presumed to be the predominant language in the place the terminology capabilities 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate terminology capabilities instances.

 When multiple useContexts are specified, there is no expectation that 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 terminology capabilities (if applicable)**

 A legal or geographic region in which the terminology capabilities is intended to be used.

 It may be possible for the terminology capabilities to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 terminology capabilities is defined**

 Explanation of why this terminology capabilities is needed and why it has been designed as it has.

 This element does not describe the usage of the terminology capabilities. 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 terminology capabilities. */
    #[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 terminology capabilities and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the terminology capabilities.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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>,
    /** **Software that is covered by this terminology capability statement**

 Software that is covered by this terminology capability statement.  It is used when the 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<TerminologyCapabilitiesSoftware>,
    /// 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 terminology 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<TerminologyCapabilitiesImplementation>,
    /// 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>,
    /** **Whether lockedDate is supported**

 Whether the server supports lockedDate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lockedDate")]
    pub locked_date: Option<bool>,
    /// 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>,
    /** **A code system supported by the server**

 Identifies a code system that is supported by the server. If there is a no code system URL, then this declares the general assumptions a client can make about support for any CodeSystem resource.

 The code system - identified by its system URL - may also be declared explicitly as a Code System Resource at /CodeSystem, but it might not be. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "codeSystem")]
    pub code_system: Vec<Option<TerminologyCapabilitiesCodeSystem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_codeSystem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_system_ext: Vec<Option<FieldExtension>>,
    /** **Information about the [ValueSet/$expand](valueset-operation-expand.html) operation**

 Information about the [ValueSet/$expand](valueset-operation-expand.html) operation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expansion")]
    pub expansion: Option<TerminologyCapabilitiesExpansion>,
    /// 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>,
    /** **[CodeSearchSupport](http://hl7.org/fhir/ValueSet/code-search-support); in-compose | in-expansion | in-compose-or-expansion**

 The degree to which the server supports the code search parameter on ValueSet, if it is supported.

 See notes on the [ValueSet](valueset.html#) resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "codeSearch")]
    pub code_search: Option<codes::CodeSearchSupport>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_codeSearch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_search_ext: Option<FieldExtension>,
    /** **Information about the [ValueSet/$validate-code](valueset-operation-validate-code.html) operation**

 Information about the [ValueSet/$validate-code](valueset-operation-validate-code.html) operation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validateCode")]
    pub validate_code: Option<TerminologyCapabilitiesValidateCode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validateCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validate_code_ext: Option<FieldExtension>,
    /** **Information about the [ConceptMap/$translate](conceptmap-operation-translate.html) operation**

 Information about the [ConceptMap/$translate](conceptmap-operation-translate.html) operation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "translation")]
    pub translation: Option<TerminologyCapabilitiesTranslation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_translation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub translation_ext: Option<FieldExtension>,
    /** **Information about the [ConceptMap/$closure](conceptmap-operation-closure.html) operation**

 Whether the $closure operation is supported.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "closure")]
    pub closure: Option<TerminologyCapabilitiesClosure>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_closure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub closure_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesBuilder {
    #[doc = concat!("Finalize building ", "TerminologyCapabilities", ".")]
    pub fn build(self) -> Result<TerminologyCapabilities, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TerminologyCapabilitiesInner> for TerminologyCapabilities {
    fn from(inner: TerminologyCapabilitiesInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for TerminologyCapabilities {
    type Target = TerminologyCapabilitiesInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for TerminologyCapabilities {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TerminologyCapabilities {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesBuilder {
        TerminologyCapabilitiesBuilder::default()
    }
}
impl TerminologyCapabilities {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::TerminologyCapabilities
    }
}
/// Choice of types for the versionAlgorithm[x] field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TerminologyCapabilitiesVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for TerminologyCapabilitiesVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TerminologyCapabilitiesVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the software field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesSoftwareBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesSoftware {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the 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>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesSoftware {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesSoftwareBuilder {
        TerminologyCapabilitiesSoftwareBuilder::default()
    }
}
/// Sub-fields of the implementation field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesImplementationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesImplementation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 terminology 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 implementation**

 An absolute base URL for the implementation.

 */
    #[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 TerminologyCapabilitiesImplementation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesImplementationBuilder {
        TerminologyCapabilitiesImplementationBuilder::default()
    }
}
/// Sub-fields of the codeSystem field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesCodeSystemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesCodeSystem {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for the code system, represented as a URI**

 Canonical identifier for the code system, represented as a URI.

 */
    #[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>,
    /** **Version of Code System supported**

 For the code system, a list of versions that are supported by the server.

 Language translations might not be available for all codes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Vec<Option<TerminologyCapabilitiesCodeSystemVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub version_ext: Vec<Option<FieldExtension>>,
    /** **[CodeSystemContentMode](http://hl7.org/fhir/ValueSet/codesystem-content-mode); not-present | example | fragment | complete | supplement**

 The extent of the content of the code system (the concepts and codes it defines) are represented in this resource instance.

 */
    #[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>,
    /** **Whether subsumption is supported**

 True if subsumption is supported for this version of the code system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subsumption")]
    pub subsumption: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subsumption")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subsumption_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesCodeSystem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesCodeSystemBuilder {
        TerminologyCapabilitiesCodeSystemBuilder::default()
    }
}
/// Sub-fields of the version field in TerminologyCapabilitiesCodeSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesCodeSystemVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesCodeSystemVersion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Version identifier for this version**

 For version-less code systems, there should be a single version with no identifier.

 */
    #[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>,
    /** **If this is the default version for this code system**

 If this is the default version for this code system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isDefault")]
    pub is_default: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isDefault")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_default_ext: Option<FieldExtension>,
    /** **If compositional grammar is supported**

 If the compositional grammar defined by the code system is supported.

 */
    #[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>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language Displays supported**

 Language Displays supported.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub language_ext: Vec<Option<FieldExtension>>,
    /** **Filter Properties supported**

 Filter Properties supported.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "filter")]
    pub filter: Vec<Option<TerminologyCapabilitiesCodeSystemVersionFilter>>,
    /// 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>>,
    /** **Properties supported for $lookup**

 Properties supported for $lookup.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<String>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesCodeSystemVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesCodeSystemVersionBuilder {
        TerminologyCapabilitiesCodeSystemVersionBuilder::default()
    }
}
/// Sub-fields of the filter field in TerminologyCapabilitiesCodeSystemVersion
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesCodeSystemVersionFilterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesCodeSystemVersionFilter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of the property supported**

 Code of the property supported.

 */
    #[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>,
    /** **Operations supported for the property**

 Operations supported for the property.

 */
    #[serde(rename = "op")]
    pub op: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_op")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub op_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesCodeSystemVersionFilter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesCodeSystemVersionFilterBuilder {
        TerminologyCapabilitiesCodeSystemVersionFilterBuilder::default()
    }
}
/// Sub-fields of the expansion field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesExpansionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesExpansion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the server can return nested value sets**

 Whether the server can return nested value sets.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hierarchical")]
    pub hierarchical: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hierarchical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hierarchical_ext: Option<FieldExtension>,
    /** **Whether the server supports paging on expansion**

 Whether the server supports paging on expansion.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paging")]
    pub paging: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paging")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub paging_ext: Option<FieldExtension>,
    /** **Allow request for incomplete expansions?**

 True if requests for incomplete expansions are allowed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "incomplete")]
    pub incomplete: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_incomplete")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub incomplete_ext: Option<FieldExtension>,
    /** **Supported expansion parameter**

 Supported expansion parameter.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<TerminologyCapabilitiesExpansionParameter>>,
    /// 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>>,
    /** **Documentation about text searching works**

 Documentation about text searching works.

 This documentation should cover things like case sensitivity,  use of punctuation if not ignored, what wild cards are supported (if any), whether text is starts with or contains, and whether word order matters. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "textFilter")]
    pub text_filter: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_textFilter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_filter_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesExpansion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesExpansionBuilder {
        TerminologyCapabilitiesExpansionBuilder::default()
    }
}
/// Sub-fields of the parameter field in TerminologyCapabilitiesExpansion
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesExpansionParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesExpansionParameter {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 supported expansion parameter**

 Name of the supported expansion parameter.

 */
    #[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>,
    /** **Description of support for parameter**

 Description of support for 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>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesExpansionParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesExpansionParameterBuilder {
        TerminologyCapabilitiesExpansionParameterBuilder::default()
    }
}
/// Sub-fields of the validateCode field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesValidateCodeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesValidateCode {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 translations are validated**

 Whether translations are validated.

 */
    #[serde(rename = "translations")]
    pub translations: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_translations")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub translations_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesValidateCode {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesValidateCodeBuilder {
        TerminologyCapabilitiesValidateCodeBuilder::default()
    }
}
/// Sub-fields of the translation field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesTranslationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesTranslation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the client must identify the map**

 Whether the client must identify the map.

 */
    #[serde(rename = "needsMap")]
    pub needs_map: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_needsMap")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub needs_map_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesTranslation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesTranslationBuilder {
        TerminologyCapabilitiesTranslationBuilder::default()
    }
}
/// Sub-fields of the closure field in TerminologyCapabilities
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TerminologyCapabilitiesClosureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TerminologyCapabilitiesClosure {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 cross-system closure is supported**

 If cross-system closure is supported.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "translation")]
    pub translation: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_translation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub translation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TerminologyCapabilitiesClosure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TerminologyCapabilitiesClosureBuilder {
        TerminologyCapabilitiesClosureBuilder::default()
    }
}
/** A plan for executing testing on an artifact or specifications

 **[TestPlan](http://hl7.org/fhir/StructureDefinition/TestPlan) v5.0.0**

 Description of intented testing

 A plan for executing testing on an artifact or specifications.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TestPlan(pub Box<TestPlanInner>);
/** A plan for executing testing on an artifact or specifications

 **[TestPlan](http://hl7.org/fhir/StructureDefinition/TestPlan) v5.0.0**

 Description of intented testing

 A plan for executing testing on an artifact or specifications.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TestPlanInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "TestPlan::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::TestPlan", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this test plan, represented as a URI (globally unique)**

 An absolute URI that is used to identify this test plan when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this test plan is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the test plan is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 identifier identifier for the test plan**

 A formal identifier that is used to identify this test plan 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, and can then identify this test plan 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 test plan**

 The identifier that is used to identify this version of the test plan when it is referenced in a specification, model, design or instance.  This is an arbitrary value managed by the test plan 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 plan instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a reference to a particular business version of the test plan with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<TestPlanVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<TestPlanVersionAlgorithmExtension>,
    /** **Name for this test plan (computer friendly)**

 A natural language name identifying the test plan. 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 alphanumeric type name to ensure that it is machine-processing 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 test plan (human friendly)**

 A short, descriptive, user-friendly title for the test plan.

 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 plan. Enables tracking the life-cycle of the content.

 Allows filtering of test plans that are appropriate for use versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 plan is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.

 Allows filtering of test plans that are appropriate for use versus not. */
    #[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 last changed**

 The date (and optionally time) when the test plan was last significantly changed. The date must change 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 plan changes.

 The date is often not tracked until the resource is published, but may be present on draft content. Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the test plan. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the test plan.

 Usually an organization but may be an individual. The publisher (or steward) of the test plan is the organization or individual primarily responsible for the maintenance and upkeep of the test plan. 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 plan. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 plan**

 A free text natural language description of the test plan from a consumer's perspective.

 This description can be used to capture details such as 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 plan 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 test plan is presumed to be the predominant language in the place the test plan 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate test plan instances.

 When multiple useContexts are specified, there is no expectation that 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 where the test plan applies (if applicable)**

 A legal or geographic region in which the test plan is intended to be used.

 It may be possible for the test plan to be used in jurisdictions other than those for which it was originally designed or intended.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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 plan is defined**

 Explanation of why this test plan is needed and why it has been designed as it has.

 This element does not describe the usage of the test plan 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 plan. */
    #[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 plan and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the test plan. The short copyright declaration (e.g. (c) '2015+ xyz organization' should be sent in the copyrightLabel element.

 */
    #[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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **[TestPlanCategory](http://hl7.org/fhir/ValueSet/testscript-scope-phase-codes); The category of the Test Plan - can be acceptance, unit, performance**

 The category of the Test Plan - can be acceptance, unit, performance, 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>>,
    /** **What is being tested with this Test Plan - a conformance resource, or narrative criteria, or an external reference**

 What is being tested with this Test Plan - a conformance resource, or narrative criteria, or an external reference...

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub scope_ext: Vec<Option<FieldExtension>>,
    /** **A description of test tools to be used in the test plan - narrative for now**

 A description of test tools to be used in the test plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "testTools")]
    pub test_tools: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_testTools")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub test_tools_ext: Option<FieldExtension>,
    /** **The required criteria to execute the test plan - e.g. preconditions, previous tests**

 The required criteria to execute the test plan - e.g. preconditions, previous tests...

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependency")]
    pub dependency: Vec<Option<TestPlanDependency>>,
    /// 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>>,
    /** **The threshold or criteria for the test plan to be considered successfully executed - narrative**

 The threshold or criteria for the test plan to be considered successfully executed - narrative.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exitCriteria")]
    pub exit_criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exitCriteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exit_criteria_ext: Option<FieldExtension>,
    /** **The test cases that constitute this plan**

 The individual test cases that are part of this plan, when they they are made explicit.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "testCase")]
    pub test_case: Vec<Option<TestPlanTestCase>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_testCase")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub test_case_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestPlanBuilder {
    #[doc = concat!("Finalize building ", "TestPlan", ".")]
    pub fn build(self) -> Result<TestPlan, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TestPlanInner> for TestPlan {
    fn from(inner: TestPlanInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for TestPlan {
    type Target = TestPlanInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for TestPlan {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TestPlan {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TestPlanBuilder {
        TestPlanBuilder::default()
    }
}
impl TestPlan {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::TestPlan
    }
}
/// Choice of types for the versionAlgorithm[x] field in TestPlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for TestPlanVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// Sub-fields of the dependency field in TestPlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanDependencyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanDependency {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of the dependency criterium**

 A textual description of the criterium - what is needed for the dependency to be considered met.

 */
    #[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>,
    /** **Link to predecessor test plans**

 Predecessor test plans - those that are expected to be successfully performed as a dependency for the execution of this test plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "predecessor")]
    pub predecessor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_predecessor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub predecessor_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestPlanDependency {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanDependencyBuilder {
        TestPlanDependencyBuilder::default()
    }
}
/// Sub-fields of the testCase field in TestPlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCase {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of test case in the test plan**

 Sequence of test case - an ordinal number that indicates the order for the present test case in the test plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequence")]
    pub sequence: Option<i32>,
    /// 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>,
    /** **The scope or artifact covered by the case**

 The scope or artifact covered by the case, when the individual test case is associated with a testable artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub scope_ext: Vec<Option<FieldExtension>>,
    /** **Required criteria to execute the test case**

 The required criteria to execute the test case - e.g. preconditions, previous tests.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependency")]
    pub dependency: Vec<Option<TestPlanTestCaseDependency>>,
    /// 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>>,
    /** **The actual test to be executed**

 The actual test to be executed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "testRun")]
    pub test_run: Vec<Option<TestPlanTestCaseTestRun>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_testRun")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub test_run_ext: Vec<Option<FieldExtension>>,
    /** **The test data used in the test case**

 The test data used in the test case.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "testData")]
    pub test_data: Vec<Option<TestPlanTestCaseTestData>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_testData")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub test_data_ext: Vec<Option<FieldExtension>>,
    /** **Test assertions or expectations**

 The test assertions - the expectations of test results from the execution of the test case.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assertion")]
    pub assertion: Vec<Option<TestPlanTestCaseAssertion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_assertion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub assertion_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCase {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseBuilder {
        TestPlanTestCaseBuilder::default()
    }
}
/// Sub-fields of the dependency field in TestPlanTestCase
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseDependencyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCaseDependency {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Description of the criteria**

 Description of the 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>,
    /** **Link to predecessor test plans**

 Link to predecessor test plans.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "predecessor")]
    pub predecessor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_predecessor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub predecessor_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCaseDependency {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseDependencyBuilder {
        TestPlanTestCaseDependencyBuilder::default()
    }
}
/// Sub-fields of the testRun field in TestPlanTestCase
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseTestRunBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCaseTestRun {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 narrative description of the tests**

 The narrative description of the tests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "narrative")]
    pub narrative: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_narrative")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub narrative_ext: Option<FieldExtension>,
    /** **The test cases in a structured language e.g. gherkin, Postman, or FHIR TestScript**

 The test cases in a structured language e.g. gherkin, Postman, or FHIR TestScript.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "script")]
    pub script: Option<TestPlanTestCaseTestRunScript>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_script")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub script_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCaseTestRun {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseTestRunBuilder {
        TestPlanTestCaseTestRunBuilder::default()
    }
}
/// Sub-fields of the script field in TestPlanTestCaseTestRun
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseTestRunScriptBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCaseTestRunScript {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 language for the test cases e.g. 'gherkin', 'testscript'**

 The language for the test cases e.g. 'gherkin', 'testscript'.

 */
    #[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>,
    /** **The actual content of the cases - references to TestScripts or externally defined content**

 The actual content of the cases - references to TestScripts or externally defined content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<TestPlanTestCaseTestRunScriptSource>,
    /// 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<TestPlanTestCaseTestRunScriptSourceExtension>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCaseTestRunScript {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseTestRunScriptBuilder {
        TestPlanTestCaseTestRunScriptBuilder::default()
    }
}
/// Choice of types for the source[x] field in TestPlanTestCaseTestRunScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanTestCaseTestRunScriptSource {
    /// Variant accepting the String type.
    #[serde(rename = "sourceString")]
    String(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "sourceReference")]
    Reference(Reference),
}
/// Extension value for TestPlanTestCaseTestRunScriptSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanTestCaseTestRunScriptSourceExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_sourceString")]
    String(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sourceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the testData field in TestPlanTestCase
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseTestDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCaseTestData {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 type of test data description, e.g. 'synthea'**

 The type of test data description, e.g. 'synthea'.

 */
    #[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>,
    /** **The actual test resources when they exist**

 The actual test resources when they exist.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Option<Reference>,
    /// 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>,
    /** **Pointer to a definition of test resources - narrative or structured e.g. synthetic data generation, etc**

 Pointer to a definition of test resources - narrative or structured e.g. synthetic data generation, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<TestPlanTestCaseTestDataSource>,
    /// 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<TestPlanTestCaseTestDataSourceExtension>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCaseTestData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseTestDataBuilder {
        TestPlanTestCaseTestDataBuilder::default()
    }
}
/// Choice of types for the source[x] field in TestPlanTestCaseTestData
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanTestCaseTestDataSource {
    /// Variant accepting the String type.
    #[serde(rename = "sourceString")]
    String(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "sourceReference")]
    Reference(Reference),
}
/// Extension value for TestPlanTestCaseTestDataSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestPlanTestCaseTestDataSourceExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_sourceString")]
    String(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sourceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the assertion field in TestPlanTestCase
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestPlanTestCaseAssertionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestPlanTestCaseAssertion {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Assertion type - for example 'informative' or 'required' **

 The test assertion type - this can be used to group assertions as 'required' or 'optional', or can be used for other classification of the assertion.

 */
    #[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 focus or object of the assertion**

 The focus or object of the assertion i.e. a resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "object")]
    pub object: Vec<Option<CodeableReference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_object")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub object_ext: Vec<Option<FieldExtension>>,
    /** **The actual result assertion**

 The test assertion - the expected outcome from the test case execution.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "result")]
    pub result: Vec<Option<CodeableReference>>,
    /// 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>>,
}
#[cfg(feature = "builders")]
impl TestPlanTestCaseAssertion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestPlanTestCaseAssertionBuilder {
        TestPlanTestCaseAssertionBuilder::default()
    }
}
/** A summary of information based on the results of executing a TestScript.

 **[TestReport](http://hl7.org/fhir/StructureDefinition/TestReport) v5.0.0**

 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>);
/** A summary of information based on the results of executing a TestScript.

 **[TestReport](http://hl7.org/fhir/StructureDefinition/TestReport) v5.0.0**

 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 TestReport 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 TestReport**

 A free text natural language name identifying the executed TestReport.

 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>,
    /** **Canonical URL 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: String,
    /// 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **Links or references to the testing requirements**

 Links or references providing traceability to the testing requirements for this assert.

 TestScript and TestReport instances are typically (and expected to be) based on known, defined test requirements and documentation. These links provide traceability from the executable/executed TestScript and TestReport tests to these requirements. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Vec<Option<TestReportSetupActionAssertRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requirement_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestReportSetupActionAssert {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupActionAssertBuilder {
        TestReportSetupActionAssertBuilder::default()
    }
}
/// Sub-fields of the requirement field in TestReportSetupActionAssert
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportSetupActionAssertRequirementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportSetupActionAssertRequirement {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Link or reference to the testing requirement**

 Link or reference providing traceability to the testing requirement for this test.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub link: Option<TestReportSetupActionAssertRequirementLink>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub link_ext: Option<TestReportSetupActionAssertRequirementLinkExtension>,
}
#[cfg(feature = "builders")]
impl TestReportSetupActionAssertRequirement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupActionAssertRequirementBuilder {
        TestReportSetupActionAssertRequirementBuilder::default()
    }
}
/// Choice of types for the link[x] field in TestReportSetupActionAssertRequirement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestReportSetupActionAssertRequirementLink {
    /// Variant accepting the Uri type.
    #[serde(rename = "linkUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "linkCanonical")]
    Canonical(String),
}
/// Extension value for TestReportSetupActionAssertRequirementLink.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestReportSetupActionAssertRequirementLinkExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_linkUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_linkCanonical")]
    Canonical(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.

 **[TestScript](http://hl7.org/fhir/StructureDefinition/TestScript) v5.0.0**

 Describes a set of tests

 A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TestScript(pub Box<TestScriptInner>);
/** A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.

 **[TestScript](http://hl7.org/fhir/StructureDefinition/TestScript) v5.0.0**

 Describes a set of tests

 A structured set of tests against a FHIR server or client 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this test script, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this test script is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the test script is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 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, and can then identify this test script 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 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 reference to a particular business version of the test script with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<TestScriptVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<TestScriptVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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 versus not.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 scripts that are appropriate for use versus not. */
    #[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 last changed**

 The date (and optionally time) when the test script was last significantly changed. The date must change 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.

 The date is often not tracked until the resource is published, but may be present on draft content. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 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 test script is presumed to be the predominant language in the place the test script 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>,
    /** **The context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate test script instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_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>,
    /** **Indication of the artifact(s) that are tested by this test case**

 The scope indicates a conformance artifact that is tested by the test(s) within this test case and the expectation of the test outcome(s) as well as the intended test phase inclusion.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Vec<Option<TestScriptScope>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub scope_ext: Vec<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 the [Resource List](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<String>>,
    /// 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>>,
    /** **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 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
    }
}
/// Choice of types for the versionAlgorithm[x] field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestScriptVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for TestScriptVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestScriptVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 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>,
    /** **The url path of the origin server**

 The explicit url path of the origin server used in this test script.

 If provided, the test engine is not expected to prompt for or accept external input of this value. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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>,
    /** **The url path of the destination server**

 The explicit url path of the destination server used in this test script.

 If provided, the test engine is not expected to prompt for or accept external input of this value. */
    #[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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(rename = "required")]
    pub required: 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(rename = "validated")]
    pub validated: 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: String,
    /// 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 scope 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 = "TestScriptScopeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptScope {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 conformance artifact being tested**

 The specific conformance artifact being tested. The canonical reference can be version-specific.

 */
    #[serde(rename = "artifact")]
    pub artifact: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_artifact")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub artifact_ext: Option<FieldExtension>,
    /** **[TestScriptScopeConformanceType](http://hl7.org/fhir/ValueSet/testscript-scope-conformance-codes); required | optional | strict**

 The expectation of whether the test must pass for the system to be considered conformant with the artifact: required - all tests are expected to pass, optional - all test are expected to pass but non-pass status may be allowed, strict - all tests are expected to pass and warnings are treated as a failure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conformance")]
    pub conformance: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conformance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conformance_ext: Option<FieldExtension>,
    /** **[TestScriptScopePhaseType](http://hl7.org/fhir/ValueSet/testscript-scope-phase-codes); unit | integration | production**

 The phase of testing for this artifact: unit - development / implementation phase, integration - internal system to system phase, production - live system to system phase (Note, this may involve pii/phi data).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "phase")]
    pub phase: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_phase")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub phase_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptScope {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptScopeBuilder {
        TestScriptScopeBuilder::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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(rename = "autocreate")]
    pub autocreate: 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(rename = "autodelete")]
    pub autodelete: 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). This is allowed to be a Parameters resource.

 See the [Resource List](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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 FHIRPath expression against the fixture body**

 The FHIRPath expression for a specific value 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 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 the list of [server interactions](http.html). */
    #[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>,
    /** **[FHIRConcreteTypes](http://hl7.org/fhir/ValueSet/concrete-fhir-types); Resource type**

 The type of the FHIR resource. See the [resource list](resourcelist.html). Data type of uri is needed when non-HL7 artifacts are identified.

 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>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); Mime type to accept in the payload of the response, with charset etc**

 The 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 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<String>,
    /// 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>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); Mime type of the request payload contents, with charset etc**

 The 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 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<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>,
    /** **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(rename = "encodeRequestUrl")]
    pub encode_request_url: 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>,
    /** **[TestScriptRequestMethodCode](http://hl7.org/fhir/ValueSet/http-operations); delete | get | options | patch | post | put | head**

 The HTTP method the test engine MUST use for this operation regardless of any other operation details.

 The primary purpose of the explicit HTTP method is support of  HTTP POST method invocation of the FHIR search. Other uses will include support of negative testing. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<codes::TestScriptRequestMethodCode>,
    /// 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>,
    /** **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.  ["If-Match" header](http.html#2.1.0.5.1).  See [Conditional Create using "If-None-Exist"](http.html#2.1.0.11).  See [Invalid "Content-Type" header](http.html#2.1.0.13.1) 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 FHIRPath expression to evaluate against the source fixture**

 The FHIRPath expression for a specific value 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>,
    /** **[MimeType](http://hl7.org/fhir/ValueSet/mimetypes); Mime type to compare against the 'Content-Type' header**

 The mime-type contents to compare against the request or response message '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 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<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>,
    /** **[AssertionManualCompletionType](http://hl7.org/fhir/ValueSet/assert-manual-completion-codes); fail | pass | skip | stop**

 The default manual completion outcome applied to this assertion.

 Manual completion is used to pause the test engine execution and evaluation allowing an external review of the defined assert condition. The defaultManualCompletion defines the default manual completion outcome applied if one of the enumerated values is not applied. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "defaultManualCompletion")]
    pub default_manual_completion: Option<codes::AssertionManualCompletionType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_defaultManualCompletion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub default_manual_completion_ext: Option<FieldExtension>,
    /** **The FHIRPath expression to be evaluated**

 The FHIRPath 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.

The FHIRPath expression can be evaluated as either a path to a specific value or as a boolean expression against the given FHIR resource. When the FHIRPath is a boolean expression, the assert.value element is not used. See [Testing FHIR Use Expressions](testing.html#expressions). */
    #[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.

See [Testing FHIR Use minimumId](testing.html##minimumId) for a more complete description of the test engine's comparison logic. */
    #[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 | manualEval**

 The operator type defines the conditional behavior of the assert.

 Operators are useful for both positive and negative testing. If operator is not specified, then the default conditional behavior is implemented as defined in [Testing FHIR Assertions](testing.html#assertion-table). */
    #[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 | head**

 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>,
    /** **[FHIRConcreteType](http://hl7.org/fhir/ValueSet/concrete-fhir-types); Resource type**

 The type of the resource.  See the [resource list](resourcelist.html).

 This will be expected resource type in response body e.g. in read, vread, search, etc.  See the [Resource List](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); continue | switchingProtocols | okay | created | accepted | nonAuthoritativeInformation | noContent | resetContent | partialContent | multipleChoices | movedPermanently | found | seeOther | notModified | useProxy | temporaryRedirect | permanentRedirect | badRequest | unauthorized | paymentRequired | forbidden | notFound | methodNotAllowed | notAcceptable | proxyAuthenticationRequired | requestTimeout | conflict | gone | lengthRequired | preconditionFailed | contentTooLarge | uriTooLong | unsupportedMediaType | rangeNotSatisfiable | expectationFailed | misdirectedRequest | unprocessableContent | upgradeRequired | internalServerError | notImplemented | badGateway | serviceUnavailable | gatewayTimeout | httpVersionNotSupported**

 continue | switchingProtocols | okay | created | accepted | nonAuthoritativeInformation | noContent | resetContent | partialContent | multipleChoices | movedPermanently | found | seeOther | notModified | useProxy | temporaryRedirect | permanentRedirect | badRequest | unauthorized | paymentRequired | forbidden | notFound | methodNotAllowed | notAcceptable | proxyAuthenticationRequired | requestTimeout | conflict | gone | lengthRequired | preconditionFailed | contentTooLarge | uriTooLong | unsupportedMediaType | rangeNotSatisfiable | expectationFailed | misdirectedRequest | unprocessableContent | upgradeRequired | internalServerError | notImplemented | badGateway | serviceUnavailable | gatewayTimeout | httpVersionNotSupported.

 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>,
    /** **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>,
    /** **If this assert fails, will the current test execution stop?**

 Whether or not the current test execution will stop on failure for this assert.

 If this element is specified and it is true, then assertion failures should not stop the current test execution from proceeding. */
    #[serde(rename = "stopTestOnFail")]
    pub stop_test_on_fail: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stopTestOnFail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stop_test_on_fail_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(rename = "warningOnly")]
    pub warning_only: 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>,
    /** **Links or references to the testing requirements**

 Links or references providing traceability to the testing requirements for this assert.

 TestScript and TestReport instances are typically (and expected to be) based on known, defined test requirements and documentation. These links provide traceability from the executable/executed TestScript and TestReport tests to these requirements. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requirement")]
    pub requirement: Vec<Option<TestScriptSetupActionAssertRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requirement_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssert {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertBuilder {
        TestScriptSetupActionAssertBuilder::default()
    }
}
/// Sub-fields of the requirement 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 = "TestScriptSetupActionAssertRequirementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRequirement {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Link or reference to the testing requirement**

 Link or reference providing traceability to the testing requirement for this test.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub link: Option<TestScriptSetupActionAssertRequirementLink>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub link_ext: Option<TestScriptSetupActionAssertRequirementLinkExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRequirement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRequirementBuilder {
        TestScriptSetupActionAssertRequirementBuilder::default()
    }
}
/// Choice of types for the link[x] field in TestScriptSetupActionAssertRequirement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestScriptSetupActionAssertRequirementLink {
    /// Variant accepting the Uri type.
    #[serde(rename = "linkUri")]
    Uri(String),
    /// Variant accepting the Canonical type.
    #[serde(rename = "linkCanonical")]
    Canonical(String),
}
/// Extension value for TestScriptSetupActionAssertRequirementLink.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TestScriptSetupActionAssertRequirementLinkExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_linkUri")]
    Uri(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_linkCanonical")]
    Canonical(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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()
    }
}
/** Record of transport.

 **[Transport](http://hl7.org/fhir/StructureDefinition/Transport) v5.0.0**

 Delivery of item

 Record of transport of item.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Transport(pub Box<TransportInner>);
/** Record of transport.

 **[Transport](http://hl7.org/fhir/StructureDefinition/Transport) v5.0.0**

 Delivery of item

 Record of transport of item.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TransportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TransportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Transport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Transport", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 transport event that is used to identify it across multiple disparate systems.

 This identifier is typically assigned by the dispenser, and may be used to reference the delivery when exchanging information about it with 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>>,
    /** **Formal definition of transport**

 The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Transport.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesCanonical")]
    pub instantiates_canonical: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesCanonical")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_canonical_ext: Option<FieldExtension>,
    /** **Formal definition of transport**

 The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Transport.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiatesUri")]
    pub instantiates_uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instantiatesUri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instantiates_uri_ext: Option<FieldExtension>,
    /** **Request fulfilled by this transport**

 BasedOn refers to a higher-level authorization that triggered the creation of the transport.  It references a "request" resource such as a ServiceRequest or Transport, which is distinct from the "request" resource the Transport is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a transport is created to fulfill a procedureRequest ( = FocusOn ) to transport a specimen to the lab.

 */
    #[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**

 A shared identifier common to multiple independent Request instances that were activated/authorized more or less simultaneously by a single author.  The presence of the same identifier on each request ties those requests together and may have business ramifications in terms of reporting of results, billing, etc.  E.g. a requisition number shared by a set of lab tests ordered together, or a prescription number shared by all meds ordered at one time.

 */
    #[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>,
    /** **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>>,
    /** **[TransportStatus](http://hl7.org/fhir/ValueSet/transport-status); in-progress | completed | abandoned | cancelled | planned | entered-in-error**

 A code specifying the state of the transport event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::TransportStatus>,
    /// 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>,
    /** **[TransportStatusReason](http://hl7.org/fhir/ValueSet/transport-status-reason); Reason for current status**

 An explanation as to why this transport is held, failed, was refused, etc.

 This applies to the current status.  Look at the history of the transport 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>,
    /** **[TransportIntent](http://hl7.org/fhir/ValueSet/transport-intent); unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option**

 Indicates the "level" of actionability associated with the Transport, i.e. i+R[9]Cs this a proposed transport, a planned transport, an actionable transport, etc.

 This element is immutable.  Proposed transports, planned transports, etc. must be distinct instances.

In most cases, Transports will have an intent of "order". */
    #[serde(rename = "intent")]
    pub intent: codes::TransportIntent,
    /// 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>,
    /** **[TransportPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the Transport 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>,
    /** **[TransportCode](http://hl7.org/fhir/ValueSet/transport-code); Transport Type**

 A name or code (or both) briefly describing what the transport involves.

 The title (eg "My Transports", "Outstanding Transports 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 transport**

 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 transport is acting on**

 The request being actioned or the resource being manipulated by this transport.

 If multiple resources need to be manipulated, use sub-transports.  (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 Transport**

 The entity who benefits from the performance of the service specified in the transport (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 transport originated**

 The healthcare event  (e.g. a patient and healthcare provider interaction) during which this transport 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>,
    /** **Completion time of the event (the occurrence)**

 Identifies the completion time of the event (the occurrence).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "completionTime")]
    pub completion_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_completionTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub completion_time_ext: Option<FieldExtension>,
    /** **Transport Creation Date**

 The date and time this transport 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>,
    /** **Transport Last Modified Date**

 The date and time of last modification to this transport.

 */
    #[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 transport to be done**

 The creator of the transport.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<Reference>,
    /// 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>,
    /** **[TransportPerformerType](http://hl7.org/fhir/ValueSet/performer-role); Requested performer**

 The kind of participant that should perform the transport.

 */
    #[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 transport execution.

 Transports 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>,
    /** **Where transport occurs**

 Principal physical location where this transport is performed.

 */
    #[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>,
    /** **Associated insurance coverage**

 Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Transport.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<Reference>>,
    /// 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>>,
    /** **Comments made about the transport**

 Free-text information captured about the transport 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 Transport**

 Links to Provenance records for past versions of this Transport that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the transport.

 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 transports**

 If the Transport.focus is a request resource and the transport 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<TransportRestriction>,
    /// 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 transport**

 Additional information that may be needed in the execution of the transport.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "input")]
    pub input: Vec<Option<TransportInput>>,
    /// 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 transport**

 Outputs produced by the Transport.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "output")]
    pub output: Vec<Option<TransportOutput>>,
    /// 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>>,
    /** **The desired location**

 The desired or final location for the transport.

 */
    #[serde(rename = "requestedLocation")]
    pub requested_location: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestedLocation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requested_location_ext: Option<FieldExtension>,
    /** **The entity current location**

 The current location for the entity to be transported.

 */
    #[serde(rename = "currentLocation")]
    pub current_location: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_currentLocation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub current_location_ext: Option<FieldExtension>,
    /** **[TransportReason](); Why transport is needed**

 A resource reference indicating why this transport needs to be performed.

 Transports might be justified based on an Observation, a Condition, a past or planned procedure, etc. This should only be included if there is no focus or if it differs from the reason indicated on the focus.    Use the CodeableConcept text element in `Transport.reasonCode` if the data is free (uncoded) text. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableReference>,
    /// 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>,
    /** **Parent (or preceding) transport**

 The transport event prior to this one.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "history")]
    pub history: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_history")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub history_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TransportBuilder {
    #[doc = concat!("Finalize building ", "Transport", ".")]
    pub fn build(self) -> Result<Transport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TransportInner> for Transport {
    fn from(inner: TransportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Transport {
    type Target = TransportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Transport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Transport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TransportBuilder {
        TransportBuilder::default()
    }
}
impl Transport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Transport
    }
}
/// Sub-fields of the restriction field in Transport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TransportRestrictionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TransportRestriction {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 transport 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 one potential recipient/target, to identify who is fulfillment is sought for.

 */
    #[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 TransportRestriction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TransportRestrictionBuilder {
        TransportRestrictionBuilder::default()
    }
}
/// Sub-fields of the input field in Transport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TransportInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TransportInput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TransportInputParameterType](); Label for the input**

 A code or description indicating how the input is intended to be used as part of the transport 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 transport**

 The value of the input parameter as a basic type.

 */
    #[serde(flatten)]
    pub value: TransportInputValue,
    /// 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<TransportInputValueExtension>,
}
#[cfg(feature = "builders")]
impl TransportInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TransportInputBuilder {
        TransportInputBuilder::default()
    }
}
/// Choice of types for the value[x] field in TransportInput
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransportInputValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
    /// 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 Integer64 type.
    #[serde(rename = "valueInteger64")]
    Integer64(Integer64),
    /// 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 Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the Uuid type.
    #[serde(rename = "valueUuid")]
    Uuid(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 CodeableReference type.
    #[serde(rename = "valueCodeableReference")]
    CodeableReference(CodeableReference),
    /// 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 RatioRange type.
    #[serde(rename = "valueRatioRange")]
    RatioRange(RatioRange),
    /// 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 ContactDetail type.
    #[serde(rename = "valueContactDetail")]
    ContactDetail(ContactDetail),
    /// Variant accepting the DataRequirement type.
    #[serde(rename = "valueDataRequirement")]
    DataRequirement(DataRequirement),
    /// Variant accepting the Expression type.
    #[serde(rename = "valueExpression")]
    Expression(Expression),
    /// Variant accepting the ParameterDefinition type.
    #[serde(rename = "valueParameterDefinition")]
    ParameterDefinition(ParameterDefinition),
    /// Variant accepting the RelatedArtifact type.
    #[serde(rename = "valueRelatedArtifact")]
    RelatedArtifact(RelatedArtifact),
    /// Variant accepting the TriggerDefinition type.
    #[serde(rename = "valueTriggerDefinition")]
    TriggerDefinition(TriggerDefinition),
    /// Variant accepting the UsageContext type.
    #[serde(rename = "valueUsageContext")]
    UsageContext(UsageContext),
    /// Variant accepting the Availability type.
    #[serde(rename = "valueAvailability")]
    Availability(Availability),
    /// Variant accepting the ExtendedContactDetail type.
    #[serde(rename = "valueExtendedContactDetail")]
    ExtendedContactDetail(ExtendedContactDetail),
    /// Variant accepting the Dosage type.
    #[serde(rename = "valueDosage")]
    Dosage(Dosage),
    /// Variant accepting the Meta type.
    #[serde(rename = "valueMeta")]
    Meta(Meta),
}
/// Extension value for TransportInputValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransportInputValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(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 Integer64 extension.
    #[serde(rename = "_valueInteger64")]
    Integer64(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 Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the Uuid extension.
    #[serde(rename = "_valueUuid")]
    Uuid(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 CodeableReference extension.
    #[serde(rename = "_valueCodeableReference")]
    CodeableReference(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 RatioRange extension.
    #[serde(rename = "_valueRatioRange")]
    RatioRange(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 ContactDetail extension.
    #[serde(rename = "_valueContactDetail")]
    ContactDetail(FieldExtension),
    /// Variant accepting the DataRequirement extension.
    #[serde(rename = "_valueDataRequirement")]
    DataRequirement(FieldExtension),
    /// Variant accepting the Expression extension.
    #[serde(rename = "_valueExpression")]
    Expression(FieldExtension),
    /// Variant accepting the ParameterDefinition extension.
    #[serde(rename = "_valueParameterDefinition")]
    ParameterDefinition(FieldExtension),
    /// Variant accepting the RelatedArtifact extension.
    #[serde(rename = "_valueRelatedArtifact")]
    RelatedArtifact(FieldExtension),
    /// Variant accepting the TriggerDefinition extension.
    #[serde(rename = "_valueTriggerDefinition")]
    TriggerDefinition(FieldExtension),
    /// Variant accepting the UsageContext extension.
    #[serde(rename = "_valueUsageContext")]
    UsageContext(FieldExtension),
    /// Variant accepting the Availability extension.
    #[serde(rename = "_valueAvailability")]
    Availability(FieldExtension),
    /// Variant accepting the ExtendedContactDetail extension.
    #[serde(rename = "_valueExtendedContactDetail")]
    ExtendedContactDetail(FieldExtension),
    /// Variant accepting the Dosage extension.
    #[serde(rename = "_valueDosage")]
    Dosage(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/// Sub-fields of the output field in Transport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TransportOutputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TransportOutput {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TransportOutputParameterType](); 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: TransportOutputValue,
    /// 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<TransportOutputValueExtension>,
}
#[cfg(feature = "builders")]
impl TransportOutput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TransportOutputBuilder {
        TransportOutputBuilder::default()
    }
}
/// Choice of types for the value[x] field in TransportOutput
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransportOutputValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Canonical type.
    #[serde(rename = "valueCanonical")]
    Canonical(String),
    /// 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 Integer64 type.
    #[serde(rename = "valueInteger64")]
    Integer64(Integer64),
    /// 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 Url type.
    #[serde(rename = "valueUrl")]
    Url(String),
    /// Variant accepting the Uuid type.
    #[serde(rename = "valueUuid")]
    Uuid(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 CodeableReference type.
    #[serde(rename = "valueCodeableReference")]
    CodeableReference(CodeableReference),
    /// 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 RatioRange type.
    #[serde(rename = "valueRatioRange")]
    RatioRange(RatioRange),
    /// 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 ContactDetail type.
    #[serde(rename = "valueContactDetail")]
    ContactDetail(ContactDetail),
    /// Variant accepting the DataRequirement type.
    #[serde(rename = "valueDataRequirement")]
    DataRequirement(DataRequirement),
    /// Variant accepting the Expression type.
    #[serde(rename = "valueExpression")]
    Expression(Expression),
    /// Variant accepting the ParameterDefinition type.
    #[serde(rename = "valueParameterDefinition")]
    ParameterDefinition(ParameterDefinition),
    /// Variant accepting the RelatedArtifact type.
    #[serde(rename = "valueRelatedArtifact")]
    RelatedArtifact(RelatedArtifact),
    /// Variant accepting the TriggerDefinition type.
    #[serde(rename = "valueTriggerDefinition")]
    TriggerDefinition(TriggerDefinition),
    /// Variant accepting the UsageContext type.
    #[serde(rename = "valueUsageContext")]
    UsageContext(UsageContext),
    /// Variant accepting the Availability type.
    #[serde(rename = "valueAvailability")]
    Availability(Availability),
    /// Variant accepting the ExtendedContactDetail type.
    #[serde(rename = "valueExtendedContactDetail")]
    ExtendedContactDetail(ExtendedContactDetail),
    /// Variant accepting the Dosage type.
    #[serde(rename = "valueDosage")]
    Dosage(Dosage),
    /// Variant accepting the Meta type.
    #[serde(rename = "valueMeta")]
    Meta(Meta),
}
/// Extension value for TransportOutputValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransportOutputValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Canonical extension.
    #[serde(rename = "_valueCanonical")]
    Canonical(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 Integer64 extension.
    #[serde(rename = "_valueInteger64")]
    Integer64(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 Url extension.
    #[serde(rename = "_valueUrl")]
    Url(FieldExtension),
    /// Variant accepting the Uuid extension.
    #[serde(rename = "_valueUuid")]
    Uuid(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 CodeableReference extension.
    #[serde(rename = "_valueCodeableReference")]
    CodeableReference(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 RatioRange extension.
    #[serde(rename = "_valueRatioRange")]
    RatioRange(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 ContactDetail extension.
    #[serde(rename = "_valueContactDetail")]
    ContactDetail(FieldExtension),
    /// Variant accepting the DataRequirement extension.
    #[serde(rename = "_valueDataRequirement")]
    DataRequirement(FieldExtension),
    /// Variant accepting the Expression extension.
    #[serde(rename = "_valueExpression")]
    Expression(FieldExtension),
    /// Variant accepting the ParameterDefinition extension.
    #[serde(rename = "_valueParameterDefinition")]
    ParameterDefinition(FieldExtension),
    /// Variant accepting the RelatedArtifact extension.
    #[serde(rename = "_valueRelatedArtifact")]
    RelatedArtifact(FieldExtension),
    /// Variant accepting the TriggerDefinition extension.
    #[serde(rename = "_valueTriggerDefinition")]
    TriggerDefinition(FieldExtension),
    /// Variant accepting the UsageContext extension.
    #[serde(rename = "_valueUsageContext")]
    UsageContext(FieldExtension),
    /// Variant accepting the Availability extension.
    #[serde(rename = "_valueAvailability")]
    Availability(FieldExtension),
    /// Variant accepting the ExtendedContactDetail extension.
    #[serde(rename = "_valueExtendedContactDetail")]
    ExtendedContactDetail(FieldExtension),
    /// Variant accepting the Dosage extension.
    #[serde(rename = "_valueDosage")]
    Dosage(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/** A ValueSet resource instance specifies a set of codes drawn from one or more code systems, intended for use in a particular context. Value sets link between [[[CodeSystem]]] definitions and their use in [coded elements](terminologies.html).

 **[ValueSet](http://hl7.org/fhir/StructureDefinition/ValueSet) v5.0.0**

 A set of codes drawn from one or more code systems

 A ValueSet resource instance specifies a set of codes drawn from one or more code systems, intended for use in a particular context. Value sets link between [CodeSystem](codesystem.html) definitions and their use in [coded elements](terminologies.html).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ValueSet(pub Box<ValueSetInner>);
/** A ValueSet resource instance specifies a set of codes drawn from one or more code systems, intended for use in a particular context. Value sets link between [[[CodeSystem]]] definitions and their use in [coded elements](terminologies.html).

 **[ValueSet](http://hl7.org/fhir/StructureDefinition/ValueSet) v5.0.0**

 A set of codes drawn from one or more code systems

 A ValueSet resource instance specifies a set of codes drawn from one or more code systems, intended for use in a particular context. Value sets link between [CodeSystem](codesystem.html) definitions and their use in [coded elements](terminologies.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 = "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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 identifier for this value set, represented as a URI (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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this value set is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the value set is stored on different servers.

 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.

The determination of when to create a new version of a resource (same url, new version) vs. defining a new artifact is up to the author.  Considerations for making this decision are found in [Technical and Business Versions](resource.html#versions).

In some cases, the resource can no longer be found at the stated url, but the url itself cannot change. Implementations can use the [meta.source](resource.html#meta) element to indicate where the current master source of the resource can be found. */
    #[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 (business identifier)**

 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, and can then 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 reference to a particular business version of the value set with the format [url]|[version]. The version SHOULD NOT contain a '#' - see [Business Version](resource.html#bv-format). */
    #[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>,
    /** **How to compare versions**

 Indicates the mechanism used to compare versions to determine which ValueSet is more current.

 If set as a string, this is a FHIRPath expression that has two additional context variables passed in - %version1 and %version2 and will return a negative number if version1 is newer, a positive number if version2 and a 0 if the version ordering can't be successfully be determined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub version_algorithm: Option<ValueSetVersionAlgorithm>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_algorithm_ext: Option<ValueSetVersionAlgorithmExtension>,
    /** **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 alphanumeric type name to ensure that it is machine-processing 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. The status of the value set applies to the value set definition (ValueSet.compose) and the associated ValueSet metadata. Expansions do not have a state.

 Allows filtering of value sets that are appropriate for use versus not.See also the [http://hl7.org/fhir/StructureDefinition/valueset-workflowStatusDescription](http://hl7.org/fhir/extensions/StructureDefinition-valueset-workflowStatusDescription.html) extension for additional status information related to the editorial process.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 sets that are appropriate for use versus not. */
    #[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 last changed**

 The date (and optionally time) when the value set metadata or content logical definition (.compose) was created or revised.

 Note that this is not the same as the meta.lastUpdated which is specific to an instance of a value set resource on a server.  Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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/steward (organization or individual)**

 The name of the organization or individual responsible for the release and ongoing maintenance of the value set.

 Usually an organization but may be an individual. 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.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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. The textual description specifies the span of meanings for concepts to be included within the Value Set Expansion, and also may specify the intended use and limitations of the Value Set.

 Description SHOULD contain instructions for clinical or administrative use and interpretation and information about misuse. Description SHOULD be populated unless the information is available from context. Description SHOULD be populated unless the value set is a contained resource (e.g. a value set defined solely in the context of a profile). */
    #[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 context that the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate value set instances.

 When multiple useContexts are specified, there is no expectation that 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.

DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'jurisdiction' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#jurisdiction and useContext.valueCodeableConcept indicating the jurisdiction.) */
    #[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**

 Explanation 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.

 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>,
    /** **Copyright holder and year(s)**

 A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').

 The (c) symbol should NOT be included in this string. It will be added by software when rendering the notation. Full details about licensing, restrictions, warrantees, etc. goes in the more general 'copyright' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyrightLabel")]
    pub copyright_label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyrightLabel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_label_ext: Option<FieldExtension>,
    /** **When the ValueSet 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 or editorial corrections.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ValueSet was last reviewed by the publisher**

 The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.

 If specified, this date follows the original approval date.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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 ValueSet is expected to be used**

 The period during which the ValueSet content was or is planned to be in active use.

 The effective period for a ValueSet determines when the content is applicable for usage and is independent of publication and review dates. For example, a valueset intended to be used for the year 2016 might be published in 2015.

See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[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>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptions related to the content of the ValueSet. Topics provide a high-level categorization as well as keywords for the ValueSet that can be useful for filtering and searching.

 DEPRECATION NOTE: For consistency, implementations are encouraged to migrate to using the new 'topic' code in the useContext element.  (I.e. useContext.code indicating http://terminology.hl7.org/CodeSystem/usage-context-type#topic and useContext.valueCodeableConcept indicating the topic) */
    #[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>>,
    /** **Who authored the ValueSet**

 An individiual or organization primarily involved in the creation and maintenance of the ValueSet.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<ContactDetail>>,
    /// 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 edited the ValueSet**

 An individual or organization primarily responsible for internal coherence of the ValueSet.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "editor")]
    pub editor: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_editor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub editor_ext: Vec<Option<FieldExtension>>,
    /** **Who reviewed the ValueSet**

 An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the ValueSet.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reviewer")]
    pub reviewer: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reviewer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reviewer_ext: Vec<Option<FieldExtension>>,
    /** **Who endorsed the ValueSet**

 An individual or organization asserted by the publisher to be responsible for officially endorsing the ValueSet for use in some setting.

 See guidance around (not) making local changes to elements [here](canonicalresource.html#localization). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endorser")]
    pub endorser: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endorser")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endorser_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, dependencies, bibliographic references, and predecessor and successor artifacts.

 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>>,
    /** **Content logical definition of the value set (CLD)**

 A set of criteria that define the contents of the value set by including or excluding codes selected from the specified code system(s) that the value set draws from. This is 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. Value set expansions are always considered to be stateless - they are a record of the set of codes in the value set at a point in time under a given set of conditions, and are not subject to ongoing maintenance.

Expansion.parameter is  a simplified list of parameters - a subset of the features of the [Parameters](parameters.html) resource. */
    #[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>,
    /** **Description of the semantic space the Value Set Expansion is intended to cover and should further clarify the text in ValueSet.description**

 Description of the semantic space the Value Set Expansion is intended to cover and should further clarify the text in ValueSet.description.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scope")]
    pub scope: Option<ValueSetScope>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scope")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scope_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
    }
}
/// Choice of types for the versionAlgorithm[x] field in ValueSet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetVersionAlgorithm {
    /// Variant accepting the String type.
    #[serde(rename = "versionAlgorithmString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "versionAlgorithmCoding")]
    Coding(Coding),
}
/// Extension value for ValueSetVersionAlgorithm.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetVersionAlgorithmExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_versionAlgorithmString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_versionAlgorithmCoding")]
    Coding(FieldExtension),
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 references with no specified version (transitive)**

 The Locked Date is  the effective date that is used to determine the version of all referenced Code Systems and Value Set Definitions included in the compose that are not already tied to a specific version.

 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 $expand parameters (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" does mean 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.

The Value Set Definition specification defines an ActiveOnly element, which is the reverse of this element e.g. (ValueSet.compose.inactive=FALSE) is the same as (VSD.ActiveOnly=TRUE). */
    #[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>>,
    /** **Property to return if client doesn't override**

 A property to return in the expansion, if the client doesn't ask for any particular properties. May be either a code from the code system definition (convenient) or a the formal URI that refers to the property. The special value '*' means all properties known to the server.

 Note that property names can clash, so using a URI is recommended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<String>>,
    /// 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>>,
}
#[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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, or the special version '*' for all versions.

 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 might not be known until a context of use binds it to a particular version. The special value '*' means all versions; It is at server discretion regarding expansions and which versions must be supported. */
    #[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 might 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 specifying a matching criterion based on the properties (including relationships) defined by the system, or on filters defined by the system. If multiple filters are specified within the include, 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 the contents included in this value set**

 Selects the concepts found in this value set (based on its value set definition). This is an absolute URI that is a reference to ValueSet.url.  If multiple value sets are specified this includes the intersection of the contents of all of the referenced value sets.

 The value set URI is either a logical reference to a defined value set such as a [SNOMED CT reference set](https://terminology.hl7.org/SNOMEDCT.html), or a direct reference to a value set definition using ValueSet.url. The reference might 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>>,
    /** **A copyright statement for the specific code system included in the value set**

 A copyright statement for the specific code system asserted by the containing ValueSet.compose.include element's system value (if the associated ValueSet.compose.include.version element is not present); or the code system and version combination (if the associated ValueSet.compose.include.version element is present).

 */
    #[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>,
}
#[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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.

 Concepts have both a ```textdisplay``` and an array of ```textdesignation```. The display is equivalent to a special designation with an implied ```textdesignation.use``` of "primary code" and a language equal to the [Resource Language](resource.html#language). */
    #[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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/all-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); Types of uses of designations**

 A code that represents types of uses of designations.

 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>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); Additional ways how this designation would be used**

 Additional codes that detail how this designation would be used, if there is more than one use.

 This was added rather than increasing the cardinality of .use to 0..* in order to maintain backward compatibility. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additionalUse")]
    pub additional_use: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_additionalUse")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub additional_use_ext: Vec<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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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/filter defined by the code system**

 A code that identifies a property or a filter 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 | child-of | descendent-leaf | exists**

 The kind of operation to perform as a part of the filter criteria.

 In case filter.property represents a property of the system, the operation applies to the selected property. In case filter.property represents a filter of the system, the operation SHALL match one of the CodeSystem.filter.operator values. */
    #[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  (if the filter represents a property defined in CodeSystem) or of the system filter value (if the filter represents a filter defined in CodeSystem) 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 value set expansion (business identifier)**

 An identifier that uniquely identifies this expansion of the valueset, based on a unique combination of the provided parameters, the system default parameters, and the underlying system code system versions etc. Systems may re-use the same identifier as long as those factors remain the same, and the expansion is the same, but are not required to do so. This is a business identifier.

 Typically, this uri is a UUID (e.g. urn:uuid:8230ff20-c97a-4167-a59d-dc2cb9df16dd). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<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>,
    /** **Opaque urls for paging through expansion results**

 As per paging Search results, the next URLs are opaque to the client, have no dictated structure, and only the server understands them.

 Clients SHOULD use the next link, if present, to page through expansion results in preference to using the offset and count parameters. Due to the optional nature of the next link, its absence does not necessarily indicate that it is the last page of results. Instead, as the offset and count parameters SHALL be populated when paging, clients can reliably use the count/offset parameters to determine whether the whole expansion is returned. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "next")]
    pub next: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_next")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub next_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 all of the parameters that affect the $expand operation. If the expansion will be persisted all of these parameters SHALL be included. If the codeSystem on the server has a specified version then this version SHALL be provided as a parameter in the expansion (note that not all code systems have a version). */
    #[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>>,
    /** **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<ValueSetExpansionProperty>>,
    /// 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>>,
    /** **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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 client or server**

 Name of the input parameter to the $expand operation; may be a server-assigned name for additional default or other server-supplied parameters used to control the expansion process.

 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),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
}
/// 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),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
}
/// Sub-fields of the property 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 = "ValueSetExpansionPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansionProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 in ValueSet.expansion.contains.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>,
    /** **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>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansionProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionPropertyBuilder {
        ValueSetExpansionPropertyBuilder::default()
    }
}
/// 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 {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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. It might not be known or specified whether a concept is inactive (and it may depend on the context of use).

 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 the code system from this code was taken. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.

 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>>,
    /** **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<ValueSetExpansionContainsProperty>>,
    /// 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>>,
    /** **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()
    }
}
/// Sub-fields of the property field in ValueSetExpansionContains
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetExpansionContainsPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansionContainsProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 ValueSet.expansion.property.code**

 A code that is a reference to ValueSet.expansion.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: ValueSetExpansionContainsPropertyValue,
    /// 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<ValueSetExpansionContainsPropertyValueExtension>,
    /** **SubProperty value for the concept**

 A subproperty value for this concept.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subProperty")]
    pub sub_property: Vec<Option<ValueSetExpansionContainsPropertySubProperty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subProperty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_property_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansionContainsProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionContainsPropertyBuilder {
        ValueSetExpansionContainsPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in ValueSetExpansionContainsProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionContainsPropertyValue {
    /// 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),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
}
/// Extension value for ValueSetExpansionContainsPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionContainsPropertyValueExtension {
    /// 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),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
}
/// Sub-fields of the subProperty field in ValueSetExpansionContainsProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetExpansionContainsPropertySubPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansionContainsPropertySubProperty {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 ValueSet.expansion.property.code**

 A code that is a reference to ValueSet.expansion.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 subproperty for this concept**

 The value of this subproperty.

 */
    #[serde(flatten)]
    pub value: ValueSetExpansionContainsPropertySubPropertyValue,
    /// 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<ValueSetExpansionContainsPropertySubPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansionContainsPropertySubProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionContainsPropertySubPropertyBuilder {
        ValueSetExpansionContainsPropertySubPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in ValueSetExpansionContainsPropertySubProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionContainsPropertySubPropertyValue {
    /// 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),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
}
/// Extension value for ValueSetExpansionContainsPropertySubPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionContainsPropertySubPropertyValueExtension {
    /// 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),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
}
/// Sub-fields of the scope 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 = "ValueSetScopeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetScope {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Criteria describing which concepts or codes should be included and why**

 Criteria describing which concepts or codes should be included and why.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inclusionCriteria")]
    pub inclusion_criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inclusionCriteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub inclusion_criteria_ext: Option<FieldExtension>,
    /** **Criteria describing which concepts or codes should be excluded and why**

 Criteria describing which concepts or codes should be excluded and why.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclusionCriteria")]
    pub exclusion_criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exclusionCriteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclusion_criteria_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetScope {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetScopeBuilder {
        ValueSetScopeBuilder::default()
    }
}
/** Describes validation requirements, source(s), status and dates for one or more elements.

 **[VerificationResult](http://hl7.org/fhir/StructureDefinition/VerificationResult) v5.0.0**

 Describes validation requirements, source(s), status and dates for one or more elements

 Describes validation requirements, source(s), status and dates for one or more elements.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct VerificationResult(pub Box<VerificationResultInner>);
/** Describes validation requirements, source(s), status and dates for one or more elements.

 **[VerificationResult](http://hl7.org/fhir/StructureDefinition/VerificationResult) v5.0.0**

 Describes validation requirements, source(s), status and dates for one or more elements

 Describes validation requirements, source(s), status and dates for one or more elements.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VerificationResultBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct VerificationResultInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "VerificationResult::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::VerificationResult", 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 resource that was validated**

 A resource that was validated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[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>>,
    /** **The fhirpath location(s) within the resource that was validated**

 The fhirpath location(s) within the resource that was validated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetLocation")]
    pub target_location: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_targetLocation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_location_ext: Vec<Option<FieldExtension>>,
    /** **[need](http://hl7.org/fhir/ValueSet/verificationresult-need); none | initial | periodic**

 The frequency with which the target must be validated (none; initial; periodic).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "need")]
    pub need: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_need")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub need_ext: Option<FieldExtension>,
    /** **[status](http://hl7.org/fhir/ValueSet/verificationresult-status); attested | validated | in-process | req-revalid | val-fail | reval-fail | entered-in-error**

 The validation status of the target (attested; validated; in process; requires revalidation; validation failed; revalidation failed).

 */
    #[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>,
    /** **When the validation status was updated**

 When the validation status was updated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<DateTime>,
    /// 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>,
    /** **[validation-type](http://hl7.org/fhir/ValueSet/verificationresult-validation-type); nothing | primary | multiple**

 What the target is validated against (nothing; primary source; multiple sources).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validationType")]
    pub validation_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validationType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validation_type_ext: Option<FieldExtension>,
    /** **[validation-process](http://hl7.org/fhir/ValueSet/verificationresult-validation-process); The primary process by which the target is validated (edit check; value set; primary source; multiple sources; standalone; in context)**

 The primary process by which the target is validated (edit check; value set; primary source; multiple sources; standalone; in context).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validationProcess")]
    pub validation_process: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_validationProcess")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub validation_process_ext: Vec<Option<FieldExtension>>,
    /** **Frequency of revalidation**

 Frequency of revalidation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "frequency")]
    pub frequency: Option<Timing>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_frequency")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub frequency_ext: Option<FieldExtension>,
    /** **The date/time validation was last completed (including failed validations)**

 The date/time validation was last completed (including failed validations).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastPerformed")]
    pub last_performed: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastPerformed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_performed_ext: Option<FieldExtension>,
    /** **The date when target is next validated, if appropriate**

 The date when target is next validated, if appropriate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nextScheduled")]
    pub next_scheduled: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nextScheduled")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub next_scheduled_ext: Option<FieldExtension>,
    /** **[failure-action](http://hl7.org/fhir/ValueSet/verificationresult-failure-action); fatal | warn | rec-only | none**

 The result if validation fails (fatal; warning; record only; none).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "failureAction")]
    pub failure_action: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_failureAction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub failure_action_ext: Option<FieldExtension>,
    /** **Information about the primary source(s) involved in validation**

 Information about the primary source(s) involved in validation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "primarySource")]
    pub primary_source: Vec<Option<VerificationResultPrimarySource>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_primarySource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub primary_source_ext: Vec<Option<FieldExtension>>,
    /** **Information about the entity attesting to information**

 Information about the entity attesting to information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attestation")]
    pub attestation: Option<VerificationResultAttestation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_attestation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub attestation_ext: Option<FieldExtension>,
    /** **Information about the entity validating information**

 Information about the entity validating information.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validator")]
    pub validator: Vec<Option<VerificationResultValidator>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_validator")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub validator_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl VerificationResultBuilder {
    #[doc = concat!("Finalize building ", "VerificationResult", ".")]
    pub fn build(self) -> Result<VerificationResult, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<VerificationResultInner> for VerificationResult {
    fn from(inner: VerificationResultInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for VerificationResult {
    type Target = VerificationResultInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for VerificationResult {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl VerificationResult {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> VerificationResultBuilder {
        VerificationResultBuilder::default()
    }
}
impl VerificationResult {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::VerificationResult
    }
}
/// Sub-fields of the primarySource field in VerificationResult
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VerificationResultPrimarySourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VerificationResultPrimarySource {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 primary source**

 Reference to the primary source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "who")]
    pub who: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_who")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub who_ext: Option<FieldExtension>,
    /** **[primary-source-type](http://hl7.org/fhir/ValueSet/verificationresult-primary-source-type); Type of primary source (License Board; Primary Education; Continuing Education; Postal Service; Relationship owner; Registration Authority; legal source; issuing source; authoritative source)**

 Type of primary source (License Board; Primary Education; Continuing Education; Postal Service; Relationship owner; Registration Authority; legal source; issuing source; authoritative source).

 */
    #[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>>,
    /** **[communication-method](http://hl7.org/fhir/ValueSet/verificationresult-communication-method); Method for exchanging information with the primary source**

 Method for communicating with the primary source (manual; API; Push).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communicationMethod")]
    pub communication_method: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_communicationMethod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub communication_method_ext: Vec<Option<FieldExtension>>,
    /** **[validation-status](http://hl7.org/fhir/ValueSet/verificationresult-validation-status); successful | failed | unknown**

 Status of the validation of the target against the primary source (successful; failed; unknown).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validationStatus")]
    pub validation_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validationStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validation_status_ext: Option<FieldExtension>,
    /** **When the target was validated against the primary source**

 When the target was validated against the primary source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validationDate")]
    pub validation_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validation_date_ext: Option<FieldExtension>,
    /** **[can-push-updates](http://hl7.org/fhir/ValueSet/verificationresult-can-push-updates); yes | no | undetermined**

 Ability of the primary source to push updates/alerts (yes; no; undetermined).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "canPushUpdates")]
    pub can_push_updates: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_canPushUpdates")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub can_push_updates_ext: Option<FieldExtension>,
    /** **[push-type-available](http://hl7.org/fhir/ValueSet/verificationresult-push-type-available); specific | any | source**

 Type of alerts/updates the primary source can send (specific requested changes; any changes; as defined by source).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pushTypeAvailable")]
    pub push_type_available: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_pushTypeAvailable")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub push_type_available_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl VerificationResultPrimarySource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VerificationResultPrimarySourceBuilder {
        VerificationResultPrimarySourceBuilder::default()
    }
}
/// Sub-fields of the attestation field in VerificationResult
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VerificationResultAttestationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VerificationResultAttestation {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 individual or organization attesting to information**

 The individual or organization attesting to information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "who")]
    pub who: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_who")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub who_ext: Option<FieldExtension>,
    /** **When the who is asserting on behalf of another (organization or individual)**

 When the who is asserting on behalf of another (organization or individual).

 */
    #[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>,
    /** **[communication-method](http://hl7.org/fhir/ValueSet/verificationresult-communication-method); The method by which attested information was submitted/retrieved**

 The method by which attested information was submitted/retrieved (manual; API; Push).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communicationMethod")]
    pub communication_method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_communicationMethod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub communication_method_ext: Option<FieldExtension>,
    /** **The date the information was attested to**

 The date the information was attested to.

 */
    #[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>,
    /** **A digital identity certificate associated with the attestation source**

 A digital identity certificate associated with the attestation source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceIdentityCertificate")]
    pub source_identity_certificate: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceIdentityCertificate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_identity_certificate_ext: Option<FieldExtension>,
    /** **A digital identity certificate associated with the proxy entity submitting attested information on behalf of the attestation source**

 A digital identity certificate associated with the proxy entity submitting attested information on behalf of the attestation source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "proxyIdentityCertificate")]
    pub proxy_identity_certificate: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_proxyIdentityCertificate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub proxy_identity_certificate_ext: Option<FieldExtension>,
    /** **Proxy signature (digital or image)**

 Signed assertion by the proxy entity indicating that they have the right to submit attested information on behalf of the attestation source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "proxySignature")]
    pub proxy_signature: Option<Signature>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_proxySignature")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub proxy_signature_ext: Option<FieldExtension>,
    /** **Attester signature (digital or image)**

 Signed assertion by the attestation source that they have attested to the information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceSignature")]
    pub source_signature: Option<Signature>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceSignature")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_signature_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl VerificationResultAttestation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VerificationResultAttestationBuilder {
        VerificationResultAttestationBuilder::default()
    }
}
/// Sub-fields of the validator field in VerificationResult
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VerificationResultValidatorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VerificationResultValidator {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 organization validating information**

 Reference to the organization validating information.

 */
    #[serde(rename = "organization")]
    pub organization: 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>,
    /** **A digital identity certificate associated with the validator**

 A digital identity certificate associated with the validator.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identityCertificate")]
    pub identity_certificate: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identityCertificate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identity_certificate_ext: Option<FieldExtension>,
    /** **Validator signature (digital or image)**

 Signed assertion by the validator that they have validated the information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attestationSignature")]
    pub attestation_signature: Option<Signature>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_attestationSignature")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub attestation_signature_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl VerificationResultValidator {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VerificationResultValidatorBuilder {
        VerificationResultValidatorBuilder::default()
    }
}
/** An authorization for the provision of glasses and/or contact lenses to a patient.

 **[VisionPrescription](http://hl7.org/fhir/StructureDefinition/VisionPrescription) v5.0.0**

 Prescription for vision correction products for a patient

 An authorization for the provision of glasses and/or contact lenses to a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct VisionPrescription(pub Box<VisionPrescriptionInner>);
/** An authorization for the provision of glasses and/or contact lenses to a patient.

 **[VisionPrescription](http://hl7.org/fhir/StructureDefinition/VisionPrescription) v5.0.0**

 Prescription for vision correction products for a patient

 An authorization for the provision 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.

 Within the context of the FHIR RESTful interactions, the resource has an id except for cases like the create and conditional update. Otherwise, the use of the resouce id depends on the given use case. */
    #[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 might 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. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.

 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. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of its narrative along with other profiles, value sets, etc. */
    #[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/all-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 can 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 a 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 information 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, nor can they have their own independent transaction scope. This is allowed to be a Parameters resource if and only if it is referenced by a resource that provides context/meaning.

 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. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels. */
    #[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. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: 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 and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 vision prescription**

 A unique identifier assigned to this vision 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.

 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>,
    /** **Response creation date**

 The date this resource was created.

 */
    #[serde(rename = "created")]
    pub created: 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 prescription is for**

 A resource reference to the person to whom the vision prescription applies.

 */
    #[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>,
    /** **Created during encounter / admission / stay**

 A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.

 */
    #[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.

 Jurisdictions determine the valid lifetime of a prescription. Typically vision prescriptions are valid for two years from the date written. */
    #[serde(rename = "dateWritten")]
    pub date_written: 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 authorized the vision prescription**

 The healthcare professional responsible for authorizing the prescription.

 */
    #[serde(rename = "prescriber")]
    pub prescriber: 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>,
    /** **Vision lens authorization**

 Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals.

 */
    #[serde(rename = "lensSpecification")]
    pub lens_specification: Vec<Option<VisionPrescriptionLensSpecification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_lensSpecification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub lens_specification_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
    }
}
/// Sub-fields of the lensSpecification 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 = "VisionPrescriptionLensSpecificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VisionPrescriptionLensSpecification {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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(rename = "product")]
    pub product: 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 specification applies.

 May also appear on the paper claim form or in the Medical Records as as OD (oculus dexter) for the right eye and OS (oculus sinister) for the left eye. */
    #[serde(rename = "eye")]
    pub eye: 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>,
    /** **Power of the lens**

 Lens power measured in dioptres (0.25 units).

 The value is negative for near-sighted and positive for far sighted.
Often insurance will not cover a lens with power between +75 and -75. */
    #[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 power for astigmatism**

 Power adjustment for astigmatism measured in dioptres (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 meridian which contain no power for astigmatism**

 Adjustment for astigmatism measured in integer degrees.

 The limits are +180 and -180 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>,
    /** **Eye alignment compensation**

 Allows for adjustment on two axis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prism")]
    pub prism: Vec<Option<VisionPrescriptionLensSpecificationPrism>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_prism")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub prism_ext: Vec<Option<FieldExtension>>,
    /** **Added power for multifocal levels**

 Power adjustment for multifocal lenses measured in dioptres (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 dioptres (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 millimetres.

 */
    #[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 millimetres.

 */
    #[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 VisionPrescriptionLensSpecification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VisionPrescriptionLensSpecificationBuilder {
        VisionPrescriptionLensSpecificationBuilder::default()
    }
}
/// Sub-fields of the prism field in VisionPrescriptionLensSpecification
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VisionPrescriptionLensSpecificationPrismBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VisionPrescriptionLensSpecificationPrism {
    /** **Unique id for inter-element referencing**

 Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored even if unrecognized**

 May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(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 of adjustment**

 Amount of prism to compensate for eye alignment in fractional units.

 */
    #[serde(rename = "amount")]
    pub amount: f64,
    /// 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>,
    /** **[VisionBase](http://hl7.org/fhir/ValueSet/vision-base-codes); up | down | in | out**

 The relative base, or reference lens edge, for the prism.

 */
    #[serde(rename = "base")]
    pub base: 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>,
}
#[cfg(feature = "builders")]
impl VisionPrescriptionLensSpecificationPrism {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VisionPrescriptionLensSpecificationPrismBuilder {
        VisionPrescriptionLensSpecificationPrismBuilder::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!(ActorDefinition)]
    ActorDefinition(ActorDefinition),
    #[doc = stringify!(AdministrableProductDefinition)]
    AdministrableProductDefinition(AdministrableProductDefinition),
    #[doc = stringify!(AdverseEvent)]
    AdverseEvent(AdverseEvent),
    #[doc = stringify!(AllergyIntolerance)]
    AllergyIntolerance(AllergyIntolerance),
    #[doc = stringify!(Appointment)]
    Appointment(Appointment),
    #[doc = stringify!(AppointmentResponse)]
    AppointmentResponse(AppointmentResponse),
    #[doc = stringify!(ArtifactAssessment)]
    ArtifactAssessment(ArtifactAssessment),
    #[doc = stringify!(AuditEvent)]
    AuditEvent(AuditEvent),
    #[doc = stringify!(Basic)]
    Basic(Basic),
    #[doc = stringify!(Binary)]
    Binary(Binary),
    #[doc = stringify!(BiologicallyDerivedProduct)]
    BiologicallyDerivedProduct(BiologicallyDerivedProduct),
    #[doc = stringify!(BiologicallyDerivedProductDispense)]
    BiologicallyDerivedProductDispense(BiologicallyDerivedProductDispense),
    #[doc = stringify!(BodyStructure)]
    BodyStructure(BodyStructure),
    #[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!(ChargeItemDefinition)]
    ChargeItemDefinition(ChargeItemDefinition),
    #[doc = stringify!(Citation)]
    Citation(Citation),
    #[doc = stringify!(Claim)]
    Claim(Claim),
    #[doc = stringify!(ClaimResponse)]
    ClaimResponse(ClaimResponse),
    #[doc = stringify!(ClinicalImpression)]
    ClinicalImpression(ClinicalImpression),
    #[doc = stringify!(ClinicalUseDefinition)]
    ClinicalUseDefinition(ClinicalUseDefinition),
    #[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!(ConditionDefinition)]
    ConditionDefinition(ConditionDefinition),
    #[doc = stringify!(Consent)]
    Consent(Consent),
    #[doc = stringify!(Contract)]
    Contract(Contract),
    #[doc = stringify!(Coverage)]
    Coverage(Coverage),
    #[doc = stringify!(CoverageEligibilityRequest)]
    CoverageEligibilityRequest(CoverageEligibilityRequest),
    #[doc = stringify!(CoverageEligibilityResponse)]
    CoverageEligibilityResponse(CoverageEligibilityResponse),
    #[doc = stringify!(DetectedIssue)]
    DetectedIssue(DetectedIssue),
    #[doc = stringify!(Device)]
    Device(Device),
    #[doc = stringify!(DeviceAssociation)]
    DeviceAssociation(DeviceAssociation),
    #[doc = stringify!(DeviceDefinition)]
    DeviceDefinition(DeviceDefinition),
    #[doc = stringify!(DeviceDispense)]
    DeviceDispense(DeviceDispense),
    #[doc = stringify!(DeviceMetric)]
    DeviceMetric(DeviceMetric),
    #[doc = stringify!(DeviceRequest)]
    DeviceRequest(DeviceRequest),
    #[doc = stringify!(DeviceUsage)]
    DeviceUsage(DeviceUsage),
    #[doc = stringify!(DiagnosticReport)]
    DiagnosticReport(DiagnosticReport),
    #[doc = stringify!(DocumentReference)]
    DocumentReference(DocumentReference),
    #[doc = stringify!(Encounter)]
    Encounter(Encounter),
    #[doc = stringify!(EncounterHistory)]
    EncounterHistory(EncounterHistory),
    #[doc = stringify!(Endpoint)]
    Endpoint(Endpoint),
    #[doc = stringify!(EnrollmentRequest)]
    EnrollmentRequest(EnrollmentRequest),
    #[doc = stringify!(EnrollmentResponse)]
    EnrollmentResponse(EnrollmentResponse),
    #[doc = stringify!(EpisodeOfCare)]
    EpisodeOfCare(EpisodeOfCare),
    #[doc = stringify!(EventDefinition)]
    EventDefinition(EventDefinition),
    #[doc = stringify!(Evidence)]
    Evidence(Evidence),
    #[doc = stringify!(EvidenceReport)]
    EvidenceReport(EvidenceReport),
    #[doc = stringify!(EvidenceVariable)]
    EvidenceVariable(EvidenceVariable),
    #[doc = stringify!(ExampleScenario)]
    ExampleScenario(ExampleScenario),
    #[doc = stringify!(ExplanationOfBenefit)]
    ExplanationOfBenefit(ExplanationOfBenefit),
    #[doc = stringify!(FamilyMemberHistory)]
    FamilyMemberHistory(FamilyMemberHistory),
    #[doc = stringify!(Flag)]
    Flag(Flag),
    #[doc = stringify!(FormularyItem)]
    FormularyItem(FormularyItem),
    #[doc = stringify!(GenomicStudy)]
    GenomicStudy(GenomicStudy),
    #[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!(ImagingSelection)]
    ImagingSelection(ImagingSelection),
    #[doc = stringify!(ImagingStudy)]
    ImagingStudy(ImagingStudy),
    #[doc = stringify!(Immunization)]
    Immunization(Immunization),
    #[doc = stringify!(ImmunizationEvaluation)]
    ImmunizationEvaluation(ImmunizationEvaluation),
    #[doc = stringify!(ImmunizationRecommendation)]
    ImmunizationRecommendation(ImmunizationRecommendation),
    #[doc = stringify!(ImplementationGuide)]
    ImplementationGuide(ImplementationGuide),
    #[doc = stringify!(Ingredient)]
    Ingredient(Ingredient),
    #[doc = stringify!(InsurancePlan)]
    InsurancePlan(InsurancePlan),
    #[doc = stringify!(InventoryItem)]
    InventoryItem(InventoryItem),
    #[doc = stringify!(InventoryReport)]
    InventoryReport(InventoryReport),
    #[doc = stringify!(Invoice)]
    Invoice(Invoice),
    #[doc = stringify!(Library)]
    Library(Library),
    #[doc = stringify!(Linkage)]
    Linkage(Linkage),
    #[doc = stringify!(List)]
    List(List),
    #[doc = stringify!(Location)]
    Location(Location),
    #[doc = stringify!(ManufacturedItemDefinition)]
    ManufacturedItemDefinition(ManufacturedItemDefinition),
    #[doc = stringify!(Measure)]
    Measure(Measure),
    #[doc = stringify!(MeasureReport)]
    MeasureReport(MeasureReport),
    #[doc = stringify!(Medication)]
    Medication(Medication),
    #[doc = stringify!(MedicationAdministration)]
    MedicationAdministration(MedicationAdministration),
    #[doc = stringify!(MedicationDispense)]
    MedicationDispense(MedicationDispense),
    #[doc = stringify!(MedicationKnowledge)]
    MedicationKnowledge(MedicationKnowledge),
    #[doc = stringify!(MedicationRequest)]
    MedicationRequest(MedicationRequest),
    #[doc = stringify!(MedicationStatement)]
    MedicationStatement(MedicationStatement),
    #[doc = stringify!(MedicinalProductDefinition)]
    MedicinalProductDefinition(MedicinalProductDefinition),
    #[doc = stringify!(MessageDefinition)]
    MessageDefinition(MessageDefinition),
    #[doc = stringify!(MessageHeader)]
    MessageHeader(MessageHeader),
    #[doc = stringify!(MolecularSequence)]
    MolecularSequence(MolecularSequence),
    #[doc = stringify!(NamingSystem)]
    NamingSystem(NamingSystem),
    #[doc = stringify!(NutritionIntake)]
    NutritionIntake(NutritionIntake),
    #[doc = stringify!(NutritionOrder)]
    NutritionOrder(NutritionOrder),
    #[doc = stringify!(NutritionProduct)]
    NutritionProduct(NutritionProduct),
    #[doc = stringify!(Observation)]
    Observation(Observation),
    #[doc = stringify!(ObservationDefinition)]
    ObservationDefinition(ObservationDefinition),
    #[doc = stringify!(OperationDefinition)]
    OperationDefinition(OperationDefinition),
    #[doc = stringify!(OperationOutcome)]
    OperationOutcome(OperationOutcome),
    #[doc = stringify!(Organization)]
    Organization(Organization),
    #[doc = stringify!(OrganizationAffiliation)]
    OrganizationAffiliation(OrganizationAffiliation),
    #[doc = stringify!(PackagedProductDefinition)]
    PackagedProductDefinition(PackagedProductDefinition),
    #[doc = stringify!(Parameters)]
    Parameters(Parameters),
    #[doc = stringify!(Patient)]
    Patient(Patient),
    #[doc = stringify!(PaymentNotice)]
    PaymentNotice(PaymentNotice),
    #[doc = stringify!(PaymentReconciliation)]
    PaymentReconciliation(PaymentReconciliation),
    #[doc = stringify!(Permission)]
    Permission(Permission),
    #[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!(Provenance)]
    Provenance(Provenance),
    #[doc = stringify!(Questionnaire)]
    Questionnaire(Questionnaire),
    #[doc = stringify!(QuestionnaireResponse)]
    QuestionnaireResponse(QuestionnaireResponse),
    #[doc = stringify!(RegulatedAuthorization)]
    RegulatedAuthorization(RegulatedAuthorization),
    #[doc = stringify!(RelatedPerson)]
    RelatedPerson(RelatedPerson),
    #[doc = stringify!(RequestOrchestration)]
    RequestOrchestration(RequestOrchestration),
    #[doc = stringify!(Requirements)]
    Requirements(Requirements),
    #[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!(ServiceRequest)]
    ServiceRequest(ServiceRequest),
    #[doc = stringify!(Slot)]
    Slot(Slot),
    #[doc = stringify!(Specimen)]
    Specimen(Specimen),
    #[doc = stringify!(SpecimenDefinition)]
    SpecimenDefinition(SpecimenDefinition),
    #[doc = stringify!(StructureDefinition)]
    StructureDefinition(StructureDefinition),
    #[doc = stringify!(StructureMap)]
    StructureMap(StructureMap),
    #[doc = stringify!(Subscription)]
    Subscription(Subscription),
    #[doc = stringify!(SubscriptionStatus)]
    SubscriptionStatus(SubscriptionStatus),
    #[doc = stringify!(SubscriptionTopic)]
    SubscriptionTopic(SubscriptionTopic),
    #[doc = stringify!(Substance)]
    Substance(Substance),
    #[doc = stringify!(SubstanceDefinition)]
    SubstanceDefinition(SubstanceDefinition),
    #[doc = stringify!(SubstanceNucleicAcid)]
    SubstanceNucleicAcid(SubstanceNucleicAcid),
    #[doc = stringify!(SubstancePolymer)]
    SubstancePolymer(SubstancePolymer),
    #[doc = stringify!(SubstanceProtein)]
    SubstanceProtein(SubstanceProtein),
    #[doc = stringify!(SubstanceReferenceInformation)]
    SubstanceReferenceInformation(SubstanceReferenceInformation),
    #[doc = stringify!(SubstanceSourceMaterial)]
    SubstanceSourceMaterial(SubstanceSourceMaterial),
    #[doc = stringify!(SupplyDelivery)]
    SupplyDelivery(SupplyDelivery),
    #[doc = stringify!(SupplyRequest)]
    SupplyRequest(SupplyRequest),
    #[doc = stringify!(Task)]
    Task(Task),
    #[doc = stringify!(TerminologyCapabilities)]
    TerminologyCapabilities(TerminologyCapabilities),
    #[doc = stringify!(TestPlan)]
    TestPlan(TestPlan),
    #[doc = stringify!(TestReport)]
    TestReport(TestReport),
    #[doc = stringify!(TestScript)]
    TestScript(TestScript),
    #[doc = stringify!(Transport)]
    Transport(Transport),
    #[doc = stringify!(ValueSet)]
    ValueSet(ValueSet),
    #[doc = stringify!(VerificationResult)]
    VerificationResult(VerificationResult),
    #[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::ActorDefinition(inner) => inner.serialize(serializer),
            Resource::AdministrableProductDefinition(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::ArtifactAssessment(inner) => inner.serialize(serializer),
            Resource::AuditEvent(inner) => inner.serialize(serializer),
            Resource::Basic(inner) => inner.serialize(serializer),
            Resource::Binary(inner) => inner.serialize(serializer),
            Resource::BiologicallyDerivedProduct(inner) => inner.serialize(serializer),
            Resource::BiologicallyDerivedProductDispense(inner) => {
                inner.serialize(serializer)
            }
            Resource::BodyStructure(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::ChargeItemDefinition(inner) => inner.serialize(serializer),
            Resource::Citation(inner) => inner.serialize(serializer),
            Resource::Claim(inner) => inner.serialize(serializer),
            Resource::ClaimResponse(inner) => inner.serialize(serializer),
            Resource::ClinicalImpression(inner) => inner.serialize(serializer),
            Resource::ClinicalUseDefinition(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::ConditionDefinition(inner) => inner.serialize(serializer),
            Resource::Consent(inner) => inner.serialize(serializer),
            Resource::Contract(inner) => inner.serialize(serializer),
            Resource::Coverage(inner) => inner.serialize(serializer),
            Resource::CoverageEligibilityRequest(inner) => inner.serialize(serializer),
            Resource::CoverageEligibilityResponse(inner) => inner.serialize(serializer),
            Resource::DetectedIssue(inner) => inner.serialize(serializer),
            Resource::Device(inner) => inner.serialize(serializer),
            Resource::DeviceAssociation(inner) => inner.serialize(serializer),
            Resource::DeviceDefinition(inner) => inner.serialize(serializer),
            Resource::DeviceDispense(inner) => inner.serialize(serializer),
            Resource::DeviceMetric(inner) => inner.serialize(serializer),
            Resource::DeviceRequest(inner) => inner.serialize(serializer),
            Resource::DeviceUsage(inner) => inner.serialize(serializer),
            Resource::DiagnosticReport(inner) => inner.serialize(serializer),
            Resource::DocumentReference(inner) => inner.serialize(serializer),
            Resource::Encounter(inner) => inner.serialize(serializer),
            Resource::EncounterHistory(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::EventDefinition(inner) => inner.serialize(serializer),
            Resource::Evidence(inner) => inner.serialize(serializer),
            Resource::EvidenceReport(inner) => inner.serialize(serializer),
            Resource::EvidenceVariable(inner) => inner.serialize(serializer),
            Resource::ExampleScenario(inner) => inner.serialize(serializer),
            Resource::ExplanationOfBenefit(inner) => inner.serialize(serializer),
            Resource::FamilyMemberHistory(inner) => inner.serialize(serializer),
            Resource::Flag(inner) => inner.serialize(serializer),
            Resource::FormularyItem(inner) => inner.serialize(serializer),
            Resource::GenomicStudy(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::ImagingSelection(inner) => inner.serialize(serializer),
            Resource::ImagingStudy(inner) => inner.serialize(serializer),
            Resource::Immunization(inner) => inner.serialize(serializer),
            Resource::ImmunizationEvaluation(inner) => inner.serialize(serializer),
            Resource::ImmunizationRecommendation(inner) => inner.serialize(serializer),
            Resource::ImplementationGuide(inner) => inner.serialize(serializer),
            Resource::Ingredient(inner) => inner.serialize(serializer),
            Resource::InsurancePlan(inner) => inner.serialize(serializer),
            Resource::InventoryItem(inner) => inner.serialize(serializer),
            Resource::InventoryReport(inner) => inner.serialize(serializer),
            Resource::Invoice(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::ManufacturedItemDefinition(inner) => inner.serialize(serializer),
            Resource::Measure(inner) => inner.serialize(serializer),
            Resource::MeasureReport(inner) => inner.serialize(serializer),
            Resource::Medication(inner) => inner.serialize(serializer),
            Resource::MedicationAdministration(inner) => inner.serialize(serializer),
            Resource::MedicationDispense(inner) => inner.serialize(serializer),
            Resource::MedicationKnowledge(inner) => inner.serialize(serializer),
            Resource::MedicationRequest(inner) => inner.serialize(serializer),
            Resource::MedicationStatement(inner) => inner.serialize(serializer),
            Resource::MedicinalProductDefinition(inner) => inner.serialize(serializer),
            Resource::MessageDefinition(inner) => inner.serialize(serializer),
            Resource::MessageHeader(inner) => inner.serialize(serializer),
            Resource::MolecularSequence(inner) => inner.serialize(serializer),
            Resource::NamingSystem(inner) => inner.serialize(serializer),
            Resource::NutritionIntake(inner) => inner.serialize(serializer),
            Resource::NutritionOrder(inner) => inner.serialize(serializer),
            Resource::NutritionProduct(inner) => inner.serialize(serializer),
            Resource::Observation(inner) => inner.serialize(serializer),
            Resource::ObservationDefinition(inner) => inner.serialize(serializer),
            Resource::OperationDefinition(inner) => inner.serialize(serializer),
            Resource::OperationOutcome(inner) => inner.serialize(serializer),
            Resource::Organization(inner) => inner.serialize(serializer),
            Resource::OrganizationAffiliation(inner) => inner.serialize(serializer),
            Resource::PackagedProductDefinition(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::Permission(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::Provenance(inner) => inner.serialize(serializer),
            Resource::Questionnaire(inner) => inner.serialize(serializer),
            Resource::QuestionnaireResponse(inner) => inner.serialize(serializer),
            Resource::RegulatedAuthorization(inner) => inner.serialize(serializer),
            Resource::RelatedPerson(inner) => inner.serialize(serializer),
            Resource::RequestOrchestration(inner) => inner.serialize(serializer),
            Resource::Requirements(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::ServiceRequest(inner) => inner.serialize(serializer),
            Resource::Slot(inner) => inner.serialize(serializer),
            Resource::Specimen(inner) => inner.serialize(serializer),
            Resource::SpecimenDefinition(inner) => inner.serialize(serializer),
            Resource::StructureDefinition(inner) => inner.serialize(serializer),
            Resource::StructureMap(inner) => inner.serialize(serializer),
            Resource::Subscription(inner) => inner.serialize(serializer),
            Resource::SubscriptionStatus(inner) => inner.serialize(serializer),
            Resource::SubscriptionTopic(inner) => inner.serialize(serializer),
            Resource::Substance(inner) => inner.serialize(serializer),
            Resource::SubstanceDefinition(inner) => inner.serialize(serializer),
            Resource::SubstanceNucleicAcid(inner) => inner.serialize(serializer),
            Resource::SubstancePolymer(inner) => inner.serialize(serializer),
            Resource::SubstanceProtein(inner) => inner.serialize(serializer),
            Resource::SubstanceReferenceInformation(inner) => inner.serialize(serializer),
            Resource::SubstanceSourceMaterial(inner) => inner.serialize(serializer),
            Resource::SupplyDelivery(inner) => inner.serialize(serializer),
            Resource::SupplyRequest(inner) => inner.serialize(serializer),
            Resource::Task(inner) => inner.serialize(serializer),
            Resource::TerminologyCapabilities(inner) => inner.serialize(serializer),
            Resource::TestPlan(inner) => inner.serialize(serializer),
            Resource::TestReport(inner) => inner.serialize(serializer),
            Resource::TestScript(inner) => inner.serialize(serializer),
            Resource::Transport(inner) => inner.serialize(serializer),
            Resource::ValueSet(inner) => inner.serialize(serializer),
            Resource::VerificationResult(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!(ActorDefinition)]
    ActorDefinition,
    #[doc = stringify!(AdministrableProductDefinition)]
    AdministrableProductDefinition,
    #[doc = stringify!(AdverseEvent)]
    AdverseEvent,
    #[doc = stringify!(AllergyIntolerance)]
    AllergyIntolerance,
    #[doc = stringify!(Appointment)]
    Appointment,
    #[doc = stringify!(AppointmentResponse)]
    AppointmentResponse,
    #[doc = stringify!(ArtifactAssessment)]
    ArtifactAssessment,
    #[doc = stringify!(AuditEvent)]
    AuditEvent,
    #[doc = stringify!(Basic)]
    Basic,
    #[doc = stringify!(Binary)]
    Binary,
    #[doc = stringify!(BiologicallyDerivedProduct)]
    BiologicallyDerivedProduct,
    #[doc = stringify!(BiologicallyDerivedProductDispense)]
    BiologicallyDerivedProductDispense,
    #[doc = stringify!(BodyStructure)]
    BodyStructure,
    #[doc = stringify!(Bundle)]
    Bundle,
    #[doc = stringify!(CapabilityStatement)]
    CapabilityStatement,
    #[doc = stringify!(CarePlan)]
    CarePlan,
    #[doc = stringify!(CareTeam)]
    CareTeam,
    #[doc = stringify!(ChargeItem)]
    ChargeItem,
    #[doc = stringify!(ChargeItemDefinition)]
    ChargeItemDefinition,
    #[doc = stringify!(Citation)]
    Citation,
    #[doc = stringify!(Claim)]
    Claim,
    #[doc = stringify!(ClaimResponse)]
    ClaimResponse,
    #[doc = stringify!(ClinicalImpression)]
    ClinicalImpression,
    #[doc = stringify!(ClinicalUseDefinition)]
    ClinicalUseDefinition,
    #[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!(ConditionDefinition)]
    ConditionDefinition,
    #[doc = stringify!(Consent)]
    Consent,
    #[doc = stringify!(Contract)]
    Contract,
    #[doc = stringify!(Coverage)]
    Coverage,
    #[doc = stringify!(CoverageEligibilityRequest)]
    CoverageEligibilityRequest,
    #[doc = stringify!(CoverageEligibilityResponse)]
    CoverageEligibilityResponse,
    #[doc = stringify!(DetectedIssue)]
    DetectedIssue,
    #[doc = stringify!(Device)]
    Device,
    #[doc = stringify!(DeviceAssociation)]
    DeviceAssociation,
    #[doc = stringify!(DeviceDefinition)]
    DeviceDefinition,
    #[doc = stringify!(DeviceDispense)]
    DeviceDispense,
    #[doc = stringify!(DeviceMetric)]
    DeviceMetric,
    #[doc = stringify!(DeviceRequest)]
    DeviceRequest,
    #[doc = stringify!(DeviceUsage)]
    DeviceUsage,
    #[doc = stringify!(DiagnosticReport)]
    DiagnosticReport,
    #[doc = stringify!(DocumentReference)]
    DocumentReference,
    #[doc = stringify!(Encounter)]
    Encounter,
    #[doc = stringify!(EncounterHistory)]
    EncounterHistory,
    #[doc = stringify!(Endpoint)]
    Endpoint,
    #[doc = stringify!(EnrollmentRequest)]
    EnrollmentRequest,
    #[doc = stringify!(EnrollmentResponse)]
    EnrollmentResponse,
    #[doc = stringify!(EpisodeOfCare)]
    EpisodeOfCare,
    #[doc = stringify!(EventDefinition)]
    EventDefinition,
    #[doc = stringify!(Evidence)]
    Evidence,
    #[doc = stringify!(EvidenceReport)]
    EvidenceReport,
    #[doc = stringify!(EvidenceVariable)]
    EvidenceVariable,
    #[doc = stringify!(ExampleScenario)]
    ExampleScenario,
    #[doc = stringify!(ExplanationOfBenefit)]
    ExplanationOfBenefit,
    #[doc = stringify!(FamilyMemberHistory)]
    FamilyMemberHistory,
    #[doc = stringify!(Flag)]
    Flag,
    #[doc = stringify!(FormularyItem)]
    FormularyItem,
    #[doc = stringify!(GenomicStudy)]
    GenomicStudy,
    #[doc = stringify!(Goal)]
    Goal,
    #[doc = stringify!(GraphDefinition)]
    GraphDefinition,
    #[doc = stringify!(Group)]
    Group,
    #[doc = stringify!(GuidanceResponse)]
    GuidanceResponse,
    #[doc = stringify!(HealthcareService)]
    HealthcareService,
    #[doc = stringify!(ImagingSelection)]
    ImagingSelection,
    #[doc = stringify!(ImagingStudy)]
    ImagingStudy,
    #[doc = stringify!(Immunization)]
    Immunization,
    #[doc = stringify!(ImmunizationEvaluation)]
    ImmunizationEvaluation,
    #[doc = stringify!(ImmunizationRecommendation)]
    ImmunizationRecommendation,
    #[doc = stringify!(ImplementationGuide)]
    ImplementationGuide,
    #[doc = stringify!(Ingredient)]
    Ingredient,
    #[doc = stringify!(InsurancePlan)]
    InsurancePlan,
    #[doc = stringify!(InventoryItem)]
    InventoryItem,
    #[doc = stringify!(InventoryReport)]
    InventoryReport,
    #[doc = stringify!(Invoice)]
    Invoice,
    #[doc = stringify!(Library)]
    Library,
    #[doc = stringify!(Linkage)]
    Linkage,
    #[doc = stringify!(List)]
    List,
    #[doc = stringify!(Location)]
    Location,
    #[doc = stringify!(ManufacturedItemDefinition)]
    ManufacturedItemDefinition,
    #[doc = stringify!(Measure)]
    Measure,
    #[doc = stringify!(MeasureReport)]
    MeasureReport,
    #[doc = stringify!(Medication)]
    Medication,
    #[doc = stringify!(MedicationAdministration)]
    MedicationAdministration,
    #[doc = stringify!(MedicationDispense)]
    MedicationDispense,
    #[doc = stringify!(MedicationKnowledge)]
    MedicationKnowledge,
    #[doc = stringify!(MedicationRequest)]
    MedicationRequest,
    #[doc = stringify!(MedicationStatement)]
    MedicationStatement,
    #[doc = stringify!(MedicinalProductDefinition)]
    MedicinalProductDefinition,
    #[doc = stringify!(MessageDefinition)]
    MessageDefinition,
    #[doc = stringify!(MessageHeader)]
    MessageHeader,
    #[doc = stringify!(MolecularSequence)]
    MolecularSequence,
    #[doc = stringify!(NamingSystem)]
    NamingSystem,
    #[doc = stringify!(NutritionIntake)]
    NutritionIntake,
    #[doc = stringify!(NutritionOrder)]
    NutritionOrder,
    #[doc = stringify!(NutritionProduct)]
    NutritionProduct,
    #[doc = stringify!(Observation)]
    Observation,
    #[doc = stringify!(ObservationDefinition)]
    ObservationDefinition,
    #[doc = stringify!(OperationDefinition)]
    OperationDefinition,
    #[doc = stringify!(OperationOutcome)]
    OperationOutcome,
    #[doc = stringify!(Organization)]
    Organization,
    #[doc = stringify!(OrganizationAffiliation)]
    OrganizationAffiliation,
    #[doc = stringify!(PackagedProductDefinition)]
    PackagedProductDefinition,
    #[doc = stringify!(Parameters)]
    Parameters,
    #[doc = stringify!(Patient)]
    Patient,
    #[doc = stringify!(PaymentNotice)]
    PaymentNotice,
    #[doc = stringify!(PaymentReconciliation)]
    PaymentReconciliation,
    #[doc = stringify!(Permission)]
    Permission,
    #[doc = stringify!(Person)]
    Person,
    #[doc = stringify!(PlanDefinition)]
    PlanDefinition,
    #[doc = stringify!(Practitioner)]
    Practitioner,
    #[doc = stringify!(PractitionerRole)]
    PractitionerRole,
    #[doc = stringify!(Procedure)]
    Procedure,
    #[doc = stringify!(Provenance)]
    Provenance,
    #[doc = stringify!(Questionnaire)]
    Questionnaire,
    #[doc = stringify!(QuestionnaireResponse)]
    QuestionnaireResponse,
    #[doc = stringify!(RegulatedAuthorization)]
    RegulatedAuthorization,
    #[doc = stringify!(RelatedPerson)]
    RelatedPerson,
    #[doc = stringify!(RequestOrchestration)]
    RequestOrchestration,
    #[doc = stringify!(Requirements)]
    Requirements,
    #[doc = stringify!(ResearchStudy)]
    ResearchStudy,
    #[doc = stringify!(ResearchSubject)]
    ResearchSubject,
    #[doc = stringify!(RiskAssessment)]
    RiskAssessment,
    #[doc = stringify!(Schedule)]
    Schedule,
    #[doc = stringify!(SearchParameter)]
    SearchParameter,
    #[doc = stringify!(ServiceRequest)]
    ServiceRequest,
    #[doc = stringify!(Slot)]
    Slot,
    #[doc = stringify!(Specimen)]
    Specimen,
    #[doc = stringify!(SpecimenDefinition)]
    SpecimenDefinition,
    #[doc = stringify!(StructureDefinition)]
    StructureDefinition,
    #[doc = stringify!(StructureMap)]
    StructureMap,
    #[doc = stringify!(Subscription)]
    Subscription,
    #[doc = stringify!(SubscriptionStatus)]
    SubscriptionStatus,
    #[doc = stringify!(SubscriptionTopic)]
    SubscriptionTopic,
    #[doc = stringify!(Substance)]
    Substance,
    #[doc = stringify!(SubstanceDefinition)]
    SubstanceDefinition,
    #[doc = stringify!(SubstanceNucleicAcid)]
    SubstanceNucleicAcid,
    #[doc = stringify!(SubstancePolymer)]
    SubstancePolymer,
    #[doc = stringify!(SubstanceProtein)]
    SubstanceProtein,
    #[doc = stringify!(SubstanceReferenceInformation)]
    SubstanceReferenceInformation,
    #[doc = stringify!(SubstanceSourceMaterial)]
    SubstanceSourceMaterial,
    #[doc = stringify!(SupplyDelivery)]
    SupplyDelivery,
    #[doc = stringify!(SupplyRequest)]
    SupplyRequest,
    #[doc = stringify!(Task)]
    Task,
    #[doc = stringify!(TerminologyCapabilities)]
    TerminologyCapabilities,
    #[doc = stringify!(TestPlan)]
    TestPlan,
    #[doc = stringify!(TestReport)]
    TestReport,
    #[doc = stringify!(TestScript)]
    TestScript,
    #[doc = stringify!(Transport)]
    Transport,
    #[doc = stringify!(ValueSet)]
    ValueSet,
    #[doc = stringify!(VerificationResult)]
    VerificationResult,
    #[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<ActorDefinition> for Resource {
    fn from(resource: ActorDefinition) -> Self {
        Self::ActorDefinition(resource)
    }
}
impl TryFrom<Resource> for ActorDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ActorDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActorDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ActorDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ActorDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActorDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ActorDefinition {
    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::ActorDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActorDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<AdministrableProductDefinition> for Resource {
    fn from(resource: AdministrableProductDefinition) -> Self {
        Self::AdministrableProductDefinition(resource)
    }
}
impl TryFrom<Resource> for AdministrableProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AdministrableProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AdministrableProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a AdministrableProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AdministrableProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AdministrableProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut AdministrableProductDefinition {
    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::AdministrableProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AdministrableProductDefinition).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<ArtifactAssessment> for Resource {
    fn from(resource: ArtifactAssessment) -> Self {
        Self::ArtifactAssessment(resource)
    }
}
impl TryFrom<Resource> for ArtifactAssessment {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ArtifactAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ArtifactAssessment).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ArtifactAssessment {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ArtifactAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ArtifactAssessment).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ArtifactAssessment {
    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::ArtifactAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ArtifactAssessment).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<BiologicallyDerivedProduct> for Resource {
    fn from(resource: BiologicallyDerivedProduct) -> Self {
        Self::BiologicallyDerivedProduct(resource)
    }
}
impl TryFrom<Resource> for BiologicallyDerivedProduct {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BiologicallyDerivedProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProduct).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a BiologicallyDerivedProduct {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BiologicallyDerivedProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProduct).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut BiologicallyDerivedProduct {
    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::BiologicallyDerivedProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProduct).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<BiologicallyDerivedProductDispense> for Resource {
    fn from(resource: BiologicallyDerivedProductDispense) -> Self {
        Self::BiologicallyDerivedProductDispense(resource)
    }
}
impl TryFrom<Resource> for BiologicallyDerivedProductDispense {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BiologicallyDerivedProductDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProductDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a BiologicallyDerivedProductDispense {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BiologicallyDerivedProductDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProductDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut BiologicallyDerivedProductDispense {
    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::BiologicallyDerivedProductDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(BiologicallyDerivedProductDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<BodyStructure> for Resource {
    fn from(resource: BodyStructure) -> Self {
        Self::BodyStructure(resource)
    }
}
impl TryFrom<Resource> for BodyStructure {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BodyStructure(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(BodyStructure).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a BodyStructure {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BodyStructure(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(BodyStructure).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut BodyStructure {
    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::BodyStructure(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(BodyStructure).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<ChargeItemDefinition> for Resource {
    fn from(resource: ChargeItemDefinition) -> Self {
        Self::ChargeItemDefinition(resource)
    }
}
impl TryFrom<Resource> for ChargeItemDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ChargeItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ChargeItemDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ChargeItemDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ChargeItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ChargeItemDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ChargeItemDefinition {
    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::ChargeItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ChargeItemDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Citation> for Resource {
    fn from(resource: Citation) -> Self {
        Self::Citation(resource)
    }
}
impl TryFrom<Resource> for Citation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Citation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Citation).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Citation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Citation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Citation).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Citation {
    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::Citation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Citation).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<ClinicalUseDefinition> for Resource {
    fn from(resource: ClinicalUseDefinition) -> Self {
        Self::ClinicalUseDefinition(resource)
    }
}
impl TryFrom<Resource> for ClinicalUseDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClinicalUseDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalUseDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ClinicalUseDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClinicalUseDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalUseDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ClinicalUseDefinition {
    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::ClinicalUseDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalUseDefinition).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<ConditionDefinition> for Resource {
    fn from(resource: ConditionDefinition) -> Self {
        Self::ConditionDefinition(resource)
    }
}
impl TryFrom<Resource> for ConditionDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ConditionDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ConditionDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ConditionDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ConditionDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ConditionDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ConditionDefinition {
    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::ConditionDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ConditionDefinition).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<CoverageEligibilityRequest> for Resource {
    fn from(resource: CoverageEligibilityRequest) -> Self {
        Self::CoverageEligibilityRequest(resource)
    }
}
impl TryFrom<Resource> for CoverageEligibilityRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CoverageEligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CoverageEligibilityRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CoverageEligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CoverageEligibilityRequest {
    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::CoverageEligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<CoverageEligibilityResponse> for Resource {
    fn from(resource: CoverageEligibilityResponse) -> Self {
        Self::CoverageEligibilityResponse(resource)
    }
}
impl TryFrom<Resource> for CoverageEligibilityResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CoverageEligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CoverageEligibilityResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CoverageEligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CoverageEligibilityResponse {
    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::CoverageEligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CoverageEligibilityResponse).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<DeviceAssociation> for Resource {
    fn from(resource: DeviceAssociation) -> Self {
        Self::DeviceAssociation(resource)
    }
}
impl TryFrom<Resource> for DeviceAssociation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceAssociation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceAssociation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceAssociation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceAssociation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceAssociation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceAssociation {
    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::DeviceAssociation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceAssociation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DeviceDefinition> for Resource {
    fn from(resource: DeviceDefinition) -> Self {
        Self::DeviceDefinition(resource)
    }
}
impl TryFrom<Resource> for DeviceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceDefinition {
    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::DeviceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DeviceDispense> for Resource {
    fn from(resource: DeviceDispense) -> Self {
        Self::DeviceDispense(resource)
    }
}
impl TryFrom<Resource> for DeviceDispense {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(DeviceDispense).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceDispense {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(DeviceDispense).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceDispense {
    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::DeviceDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(DeviceDispense).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<DeviceUsage> for Resource {
    fn from(resource: DeviceUsage) -> Self {
        Self::DeviceUsage(resource)
    }
}
impl TryFrom<Resource> for DeviceUsage {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceUsage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceUsage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceUsage {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceUsage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceUsage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceUsage {
    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::DeviceUsage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceUsage).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<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<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<EncounterHistory> for Resource {
    fn from(resource: EncounterHistory) -> Self {
        Self::EncounterHistory(resource)
    }
}
impl TryFrom<Resource> for EncounterHistory {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EncounterHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EncounterHistory).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EncounterHistory {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EncounterHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EncounterHistory).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EncounterHistory {
    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::EncounterHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EncounterHistory).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<EventDefinition> for Resource {
    fn from(resource: EventDefinition) -> Self {
        Self::EventDefinition(resource)
    }
}
impl TryFrom<Resource> for EventDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EventDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EventDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EventDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EventDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EventDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EventDefinition {
    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::EventDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EventDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Evidence> for Resource {
    fn from(resource: Evidence) -> Self {
        Self::Evidence(resource)
    }
}
impl TryFrom<Resource> for Evidence {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Evidence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Evidence).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Evidence {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Evidence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Evidence).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Evidence {
    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::Evidence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Evidence).to_owned())),
        }
    }
}
impl From<EvidenceReport> for Resource {
    fn from(resource: EvidenceReport) -> Self {
        Self::EvidenceReport(resource)
    }
}
impl TryFrom<Resource> for EvidenceReport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EvidenceReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(EvidenceReport).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EvidenceReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EvidenceReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(EvidenceReport).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EvidenceReport {
    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::EvidenceReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(EvidenceReport).to_owned()),
                )
            }
        }
    }
}
impl From<EvidenceVariable> for Resource {
    fn from(resource: EvidenceVariable) -> Self {
        Self::EvidenceVariable(resource)
    }
}
impl TryFrom<Resource> for EvidenceVariable {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EvidenceVariable(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EvidenceVariable).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EvidenceVariable {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EvidenceVariable(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EvidenceVariable).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EvidenceVariable {
    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::EvidenceVariable(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EvidenceVariable).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ExampleScenario> for Resource {
    fn from(resource: ExampleScenario) -> Self {
        Self::ExampleScenario(resource)
    }
}
impl TryFrom<Resource> for ExampleScenario {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExampleScenario(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExampleScenario).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ExampleScenario {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExampleScenario(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExampleScenario).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ExampleScenario {
    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::ExampleScenario(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExampleScenario).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<FormularyItem> for Resource {
    fn from(resource: FormularyItem) -> Self {
        Self::FormularyItem(resource)
    }
}
impl TryFrom<Resource> for FormularyItem {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::FormularyItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(FormularyItem).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a FormularyItem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::FormularyItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(FormularyItem).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut FormularyItem {
    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::FormularyItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(FormularyItem).to_owned()))
            }
        }
    }
}
impl From<GenomicStudy> for Resource {
    fn from(resource: GenomicStudy) -> Self {
        Self::GenomicStudy(resource)
    }
}
impl TryFrom<Resource> for GenomicStudy {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GenomicStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(GenomicStudy).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a GenomicStudy {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GenomicStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(GenomicStudy).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut GenomicStudy {
    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::GenomicStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(GenomicStudy).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<ImagingSelection> for Resource {
    fn from(resource: ImagingSelection) -> Self {
        Self::ImagingSelection(resource)
    }
}
impl TryFrom<Resource> for ImagingSelection {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingSelection(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingSelection).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImagingSelection {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingSelection(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingSelection).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImagingSelection {
    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::ImagingSelection(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingSelection).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<ImmunizationEvaluation> for Resource {
    fn from(resource: ImmunizationEvaluation) -> Self {
        Self::ImmunizationEvaluation(resource)
    }
}
impl TryFrom<Resource> for ImmunizationEvaluation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImmunizationEvaluation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationEvaluation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImmunizationEvaluation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImmunizationEvaluation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationEvaluation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImmunizationEvaluation {
    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::ImmunizationEvaluation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationEvaluation).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<Ingredient> for Resource {
    fn from(resource: Ingredient) -> Self {
        Self::Ingredient(resource)
    }
}
impl TryFrom<Resource> for Ingredient {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Ingredient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Ingredient).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Ingredient {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Ingredient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Ingredient).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Ingredient {
    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::Ingredient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Ingredient).to_owned())),
        }
    }
}
impl From<InsurancePlan> for Resource {
    fn from(resource: InsurancePlan) -> Self {
        Self::InsurancePlan(resource)
    }
}
impl TryFrom<Resource> for InsurancePlan {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InsurancePlan(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InsurancePlan).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a InsurancePlan {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InsurancePlan(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InsurancePlan).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut InsurancePlan {
    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::InsurancePlan(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InsurancePlan).to_owned()))
            }
        }
    }
}
impl From<InventoryItem> for Resource {
    fn from(resource: InventoryItem) -> Self {
        Self::InventoryItem(resource)
    }
}
impl TryFrom<Resource> for InventoryItem {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InventoryItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InventoryItem).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a InventoryItem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InventoryItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InventoryItem).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut InventoryItem {
    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::InventoryItem(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(InventoryItem).to_owned()))
            }
        }
    }
}
impl From<InventoryReport> for Resource {
    fn from(resource: InventoryReport) -> Self {
        Self::InventoryReport(resource)
    }
}
impl TryFrom<Resource> for InventoryReport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InventoryReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(InventoryReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a InventoryReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::InventoryReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(InventoryReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut InventoryReport {
    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::InventoryReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(InventoryReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Invoice> for Resource {
    fn from(resource: Invoice) -> Self {
        Self::Invoice(resource)
    }
}
impl TryFrom<Resource> for Invoice {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Invoice(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Invoice).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Invoice {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Invoice(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Invoice).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Invoice {
    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::Invoice(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Invoice).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<ManufacturedItemDefinition> for Resource {
    fn from(resource: ManufacturedItemDefinition) -> Self {
        Self::ManufacturedItemDefinition(resource)
    }
}
impl TryFrom<Resource> for ManufacturedItemDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ManufacturedItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ManufacturedItemDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ManufacturedItemDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ManufacturedItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ManufacturedItemDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ManufacturedItemDefinition {
    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::ManufacturedItemDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ManufacturedItemDefinition).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<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<MedicationKnowledge> for Resource {
    fn from(resource: MedicationKnowledge) -> Self {
        Self::MedicationKnowledge(resource)
    }
}
impl TryFrom<Resource> for MedicationKnowledge {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationKnowledge(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationKnowledge).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicationKnowledge {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationKnowledge(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationKnowledge).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicationKnowledge {
    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::MedicationKnowledge(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationKnowledge).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<MedicinalProductDefinition> for Resource {
    fn from(resource: MedicinalProductDefinition) -> Self {
        Self::MedicinalProductDefinition(resource)
    }
}
impl TryFrom<Resource> for MedicinalProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicinalProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicinalProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicinalProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicinalProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicinalProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicinalProductDefinition {
    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::MedicinalProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicinalProductDefinition).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<MolecularSequence> for Resource {
    fn from(resource: MolecularSequence) -> Self {
        Self::MolecularSequence(resource)
    }
}
impl TryFrom<Resource> for MolecularSequence {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MolecularSequence(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MolecularSequence).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MolecularSequence {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MolecularSequence(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MolecularSequence).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MolecularSequence {
    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::MolecularSequence(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MolecularSequence).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<NutritionIntake> for Resource {
    fn from(resource: NutritionIntake) -> Self {
        Self::NutritionIntake(resource)
    }
}
impl TryFrom<Resource> for NutritionIntake {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionIntake(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionIntake).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a NutritionIntake {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionIntake(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionIntake).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut NutritionIntake {
    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::NutritionIntake(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionIntake).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<NutritionProduct> for Resource {
    fn from(resource: NutritionProduct) -> Self {
        Self::NutritionProduct(resource)
    }
}
impl TryFrom<Resource> for NutritionProduct {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionProduct).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a NutritionProduct {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionProduct).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut NutritionProduct {
    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::NutritionProduct(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(NutritionProduct).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<ObservationDefinition> for Resource {
    fn from(resource: ObservationDefinition) -> Self {
        Self::ObservationDefinition(resource)
    }
}
impl TryFrom<Resource> for ObservationDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ObservationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ObservationDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ObservationDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ObservationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ObservationDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ObservationDefinition {
    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::ObservationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ObservationDefinition).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<OrganizationAffiliation> for Resource {
    fn from(resource: OrganizationAffiliation) -> Self {
        Self::OrganizationAffiliation(resource)
    }
}
impl TryFrom<Resource> for OrganizationAffiliation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OrganizationAffiliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OrganizationAffiliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a OrganizationAffiliation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OrganizationAffiliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OrganizationAffiliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut OrganizationAffiliation {
    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::OrganizationAffiliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OrganizationAffiliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<PackagedProductDefinition> for Resource {
    fn from(resource: PackagedProductDefinition) -> Self {
        Self::PackagedProductDefinition(resource)
    }
}
impl TryFrom<Resource> for PackagedProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PackagedProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PackagedProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a PackagedProductDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PackagedProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PackagedProductDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut PackagedProductDefinition {
    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::PackagedProductDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PackagedProductDefinition).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<Permission> for Resource {
    fn from(resource: Permission) -> Self {
        Self::Permission(resource)
    }
}
impl TryFrom<Resource> for Permission {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Permission(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Permission).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Permission {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Permission(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Permission).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Permission {
    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::Permission(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Permission).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<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<RegulatedAuthorization> for Resource {
    fn from(resource: RegulatedAuthorization) -> Self {
        Self::RegulatedAuthorization(resource)
    }
}
impl TryFrom<Resource> for RegulatedAuthorization {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RegulatedAuthorization(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RegulatedAuthorization).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a RegulatedAuthorization {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RegulatedAuthorization(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RegulatedAuthorization).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut RegulatedAuthorization {
    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::RegulatedAuthorization(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RegulatedAuthorization).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<RequestOrchestration> for Resource {
    fn from(resource: RequestOrchestration) -> Self {
        Self::RequestOrchestration(resource)
    }
}
impl TryFrom<Resource> for RequestOrchestration {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RequestOrchestration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RequestOrchestration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a RequestOrchestration {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RequestOrchestration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RequestOrchestration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut RequestOrchestration {
    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::RequestOrchestration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(RequestOrchestration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Requirements> for Resource {
    fn from(resource: Requirements) -> Self {
        Self::Requirements(resource)
    }
}
impl TryFrom<Resource> for Requirements {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Requirements(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Requirements).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Requirements {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Requirements(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Requirements).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Requirements {
    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::Requirements(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Requirements).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<ServiceRequest> for Resource {
    fn from(resource: ServiceRequest) -> Self {
        Self::ServiceRequest(resource)
    }
}
impl TryFrom<Resource> for ServiceRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ServiceRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ServiceRequest).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ServiceRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ServiceRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ServiceRequest).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ServiceRequest {
    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::ServiceRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ServiceRequest).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<SpecimenDefinition> for Resource {
    fn from(resource: SpecimenDefinition) -> Self {
        Self::SpecimenDefinition(resource)
    }
}
impl TryFrom<Resource> for SpecimenDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SpecimenDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SpecimenDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SpecimenDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SpecimenDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SpecimenDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SpecimenDefinition {
    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::SpecimenDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SpecimenDefinition).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<SubscriptionStatus> for Resource {
    fn from(resource: SubscriptionStatus) -> Self {
        Self::SubscriptionStatus(resource)
    }
}
impl TryFrom<Resource> for SubscriptionStatus {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubscriptionStatus(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionStatus).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubscriptionStatus {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubscriptionStatus(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionStatus).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubscriptionStatus {
    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::SubscriptionStatus(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionStatus).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubscriptionTopic> for Resource {
    fn from(resource: SubscriptionTopic) -> Self {
        Self::SubscriptionTopic(resource)
    }
}
impl TryFrom<Resource> for SubscriptionTopic {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubscriptionTopic(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionTopic).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubscriptionTopic {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubscriptionTopic(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionTopic).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubscriptionTopic {
    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::SubscriptionTopic(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubscriptionTopic).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<SubstanceDefinition> for Resource {
    fn from(resource: SubstanceDefinition) -> Self {
        Self::SubstanceDefinition(resource)
    }
}
impl TryFrom<Resource> for SubstanceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstanceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstanceDefinition {
    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::SubstanceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubstanceNucleicAcid> for Resource {
    fn from(resource: SubstanceNucleicAcid) -> Self {
        Self::SubstanceNucleicAcid(resource)
    }
}
impl TryFrom<Resource> for SubstanceNucleicAcid {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceNucleicAcid(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceNucleicAcid).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstanceNucleicAcid {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceNucleicAcid(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceNucleicAcid).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstanceNucleicAcid {
    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::SubstanceNucleicAcid(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceNucleicAcid).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubstancePolymer> for Resource {
    fn from(resource: SubstancePolymer) -> Self {
        Self::SubstancePolymer(resource)
    }
}
impl TryFrom<Resource> for SubstancePolymer {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstancePolymer(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstancePolymer).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstancePolymer {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstancePolymer(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstancePolymer).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstancePolymer {
    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::SubstancePolymer(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstancePolymer).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubstanceProtein> for Resource {
    fn from(resource: SubstanceProtein) -> Self {
        Self::SubstanceProtein(resource)
    }
}
impl TryFrom<Resource> for SubstanceProtein {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceProtein(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceProtein).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstanceProtein {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceProtein(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceProtein).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstanceProtein {
    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::SubstanceProtein(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceProtein).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubstanceReferenceInformation> for Resource {
    fn from(resource: SubstanceReferenceInformation) -> Self {
        Self::SubstanceReferenceInformation(resource)
    }
}
impl TryFrom<Resource> for SubstanceReferenceInformation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceReferenceInformation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceReferenceInformation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstanceReferenceInformation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceReferenceInformation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceReferenceInformation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstanceReferenceInformation {
    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::SubstanceReferenceInformation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceReferenceInformation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<SubstanceSourceMaterial> for Resource {
    fn from(resource: SubstanceSourceMaterial) -> Self {
        Self::SubstanceSourceMaterial(resource)
    }
}
impl TryFrom<Resource> for SubstanceSourceMaterial {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceSourceMaterial(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceSourceMaterial).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SubstanceSourceMaterial {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SubstanceSourceMaterial(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceSourceMaterial).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SubstanceSourceMaterial {
    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::SubstanceSourceMaterial(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SubstanceSourceMaterial).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<TerminologyCapabilities> for Resource {
    fn from(resource: TerminologyCapabilities) -> Self {
        Self::TerminologyCapabilities(resource)
    }
}
impl TryFrom<Resource> for TerminologyCapabilities {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TerminologyCapabilities(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(TerminologyCapabilities).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a TerminologyCapabilities {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TerminologyCapabilities(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(TerminologyCapabilities).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut TerminologyCapabilities {
    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::TerminologyCapabilities(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(TerminologyCapabilities).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<TestPlan> for Resource {
    fn from(resource: TestPlan) -> Self {
        Self::TestPlan(resource)
    }
}
impl TryFrom<Resource> for TestPlan {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestPlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestPlan).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a TestPlan {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestPlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestPlan).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut TestPlan {
    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::TestPlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestPlan).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<Transport> for Resource {
    fn from(resource: Transport) -> Self {
        Self::Transport(resource)
    }
}
impl TryFrom<Resource> for Transport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Transport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Transport).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Transport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Transport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Transport).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Transport {
    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::Transport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Transport).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<VerificationResult> for Resource {
    fn from(resource: VerificationResult) -> Self {
        Self::VerificationResult(resource)
    }
}
impl TryFrom<Resource> for VerificationResult {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::VerificationResult(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VerificationResult).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a VerificationResult {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::VerificationResult(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VerificationResult).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut VerificationResult {
    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::VerificationResult(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VerificationResult).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::ActorDefinition(_) => ResourceType::ActorDefinition,
            Self::AdministrableProductDefinition(_) => {
                ResourceType::AdministrableProductDefinition
            }
            Self::AdverseEvent(_) => ResourceType::AdverseEvent,
            Self::AllergyIntolerance(_) => ResourceType::AllergyIntolerance,
            Self::Appointment(_) => ResourceType::Appointment,
            Self::AppointmentResponse(_) => ResourceType::AppointmentResponse,
            Self::ArtifactAssessment(_) => ResourceType::ArtifactAssessment,
            Self::AuditEvent(_) => ResourceType::AuditEvent,
            Self::Basic(_) => ResourceType::Basic,
            Self::Binary(_) => ResourceType::Binary,
            Self::BiologicallyDerivedProduct(_) => {
                ResourceType::BiologicallyDerivedProduct
            }
            Self::BiologicallyDerivedProductDispense(_) => {
                ResourceType::BiologicallyDerivedProductDispense
            }
            Self::BodyStructure(_) => ResourceType::BodyStructure,
            Self::Bundle(_) => ResourceType::Bundle,
            Self::CapabilityStatement(_) => ResourceType::CapabilityStatement,
            Self::CarePlan(_) => ResourceType::CarePlan,
            Self::CareTeam(_) => ResourceType::CareTeam,
            Self::ChargeItem(_) => ResourceType::ChargeItem,
            Self::ChargeItemDefinition(_) => ResourceType::ChargeItemDefinition,
            Self::Citation(_) => ResourceType::Citation,
            Self::Claim(_) => ResourceType::Claim,
            Self::ClaimResponse(_) => ResourceType::ClaimResponse,
            Self::ClinicalImpression(_) => ResourceType::ClinicalImpression,
            Self::ClinicalUseDefinition(_) => ResourceType::ClinicalUseDefinition,
            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::ConditionDefinition(_) => ResourceType::ConditionDefinition,
            Self::Consent(_) => ResourceType::Consent,
            Self::Contract(_) => ResourceType::Contract,
            Self::Coverage(_) => ResourceType::Coverage,
            Self::CoverageEligibilityRequest(_) => {
                ResourceType::CoverageEligibilityRequest
            }
            Self::CoverageEligibilityResponse(_) => {
                ResourceType::CoverageEligibilityResponse
            }
            Self::DetectedIssue(_) => ResourceType::DetectedIssue,
            Self::Device(_) => ResourceType::Device,
            Self::DeviceAssociation(_) => ResourceType::DeviceAssociation,
            Self::DeviceDefinition(_) => ResourceType::DeviceDefinition,
            Self::DeviceDispense(_) => ResourceType::DeviceDispense,
            Self::DeviceMetric(_) => ResourceType::DeviceMetric,
            Self::DeviceRequest(_) => ResourceType::DeviceRequest,
            Self::DeviceUsage(_) => ResourceType::DeviceUsage,
            Self::DiagnosticReport(_) => ResourceType::DiagnosticReport,
            Self::DocumentReference(_) => ResourceType::DocumentReference,
            Self::Encounter(_) => ResourceType::Encounter,
            Self::EncounterHistory(_) => ResourceType::EncounterHistory,
            Self::Endpoint(_) => ResourceType::Endpoint,
            Self::EnrollmentRequest(_) => ResourceType::EnrollmentRequest,
            Self::EnrollmentResponse(_) => ResourceType::EnrollmentResponse,
            Self::EpisodeOfCare(_) => ResourceType::EpisodeOfCare,
            Self::EventDefinition(_) => ResourceType::EventDefinition,
            Self::Evidence(_) => ResourceType::Evidence,
            Self::EvidenceReport(_) => ResourceType::EvidenceReport,
            Self::EvidenceVariable(_) => ResourceType::EvidenceVariable,
            Self::ExampleScenario(_) => ResourceType::ExampleScenario,
            Self::ExplanationOfBenefit(_) => ResourceType::ExplanationOfBenefit,
            Self::FamilyMemberHistory(_) => ResourceType::FamilyMemberHistory,
            Self::Flag(_) => ResourceType::Flag,
            Self::FormularyItem(_) => ResourceType::FormularyItem,
            Self::GenomicStudy(_) => ResourceType::GenomicStudy,
            Self::Goal(_) => ResourceType::Goal,
            Self::GraphDefinition(_) => ResourceType::GraphDefinition,
            Self::Group(_) => ResourceType::Group,
            Self::GuidanceResponse(_) => ResourceType::GuidanceResponse,
            Self::HealthcareService(_) => ResourceType::HealthcareService,
            Self::ImagingSelection(_) => ResourceType::ImagingSelection,
            Self::ImagingStudy(_) => ResourceType::ImagingStudy,
            Self::Immunization(_) => ResourceType::Immunization,
            Self::ImmunizationEvaluation(_) => ResourceType::ImmunizationEvaluation,
            Self::ImmunizationRecommendation(_) => {
                ResourceType::ImmunizationRecommendation
            }
            Self::ImplementationGuide(_) => ResourceType::ImplementationGuide,
            Self::Ingredient(_) => ResourceType::Ingredient,
            Self::InsurancePlan(_) => ResourceType::InsurancePlan,
            Self::InventoryItem(_) => ResourceType::InventoryItem,
            Self::InventoryReport(_) => ResourceType::InventoryReport,
            Self::Invoice(_) => ResourceType::Invoice,
            Self::Library(_) => ResourceType::Library,
            Self::Linkage(_) => ResourceType::Linkage,
            Self::List(_) => ResourceType::List,
            Self::Location(_) => ResourceType::Location,
            Self::ManufacturedItemDefinition(_) => {
                ResourceType::ManufacturedItemDefinition
            }
            Self::Measure(_) => ResourceType::Measure,
            Self::MeasureReport(_) => ResourceType::MeasureReport,
            Self::Medication(_) => ResourceType::Medication,
            Self::MedicationAdministration(_) => ResourceType::MedicationAdministration,
            Self::MedicationDispense(_) => ResourceType::MedicationDispense,
            Self::MedicationKnowledge(_) => ResourceType::MedicationKnowledge,
            Self::MedicationRequest(_) => ResourceType::MedicationRequest,
            Self::MedicationStatement(_) => ResourceType::MedicationStatement,
            Self::MedicinalProductDefinition(_) => {
                ResourceType::MedicinalProductDefinition
            }
            Self::MessageDefinition(_) => ResourceType::MessageDefinition,
            Self::MessageHeader(_) => ResourceType::MessageHeader,
            Self::MolecularSequence(_) => ResourceType::MolecularSequence,
            Self::NamingSystem(_) => ResourceType::NamingSystem,
            Self::NutritionIntake(_) => ResourceType::NutritionIntake,
            Self::NutritionOrder(_) => ResourceType::NutritionOrder,
            Self::NutritionProduct(_) => ResourceType::NutritionProduct,
            Self::Observation(_) => ResourceType::Observation,
            Self::ObservationDefinition(_) => ResourceType::ObservationDefinition,
            Self::OperationDefinition(_) => ResourceType::OperationDefinition,
            Self::OperationOutcome(_) => ResourceType::OperationOutcome,
            Self::Organization(_) => ResourceType::Organization,
            Self::OrganizationAffiliation(_) => ResourceType::OrganizationAffiliation,
            Self::PackagedProductDefinition(_) => ResourceType::PackagedProductDefinition,
            Self::Parameters(_) => ResourceType::Parameters,
            Self::Patient(_) => ResourceType::Patient,
            Self::PaymentNotice(_) => ResourceType::PaymentNotice,
            Self::PaymentReconciliation(_) => ResourceType::PaymentReconciliation,
            Self::Permission(_) => ResourceType::Permission,
            Self::Person(_) => ResourceType::Person,
            Self::PlanDefinition(_) => ResourceType::PlanDefinition,
            Self::Practitioner(_) => ResourceType::Practitioner,
            Self::PractitionerRole(_) => ResourceType::PractitionerRole,
            Self::Procedure(_) => ResourceType::Procedure,
            Self::Provenance(_) => ResourceType::Provenance,
            Self::Questionnaire(_) => ResourceType::Questionnaire,
            Self::QuestionnaireResponse(_) => ResourceType::QuestionnaireResponse,
            Self::RegulatedAuthorization(_) => ResourceType::RegulatedAuthorization,
            Self::RelatedPerson(_) => ResourceType::RelatedPerson,
            Self::RequestOrchestration(_) => ResourceType::RequestOrchestration,
            Self::Requirements(_) => ResourceType::Requirements,
            Self::ResearchStudy(_) => ResourceType::ResearchStudy,
            Self::ResearchSubject(_) => ResourceType::ResearchSubject,
            Self::RiskAssessment(_) => ResourceType::RiskAssessment,
            Self::Schedule(_) => ResourceType::Schedule,
            Self::SearchParameter(_) => ResourceType::SearchParameter,
            Self::ServiceRequest(_) => ResourceType::ServiceRequest,
            Self::Slot(_) => ResourceType::Slot,
            Self::Specimen(_) => ResourceType::Specimen,
            Self::SpecimenDefinition(_) => ResourceType::SpecimenDefinition,
            Self::StructureDefinition(_) => ResourceType::StructureDefinition,
            Self::StructureMap(_) => ResourceType::StructureMap,
            Self::Subscription(_) => ResourceType::Subscription,
            Self::SubscriptionStatus(_) => ResourceType::SubscriptionStatus,
            Self::SubscriptionTopic(_) => ResourceType::SubscriptionTopic,
            Self::Substance(_) => ResourceType::Substance,
            Self::SubstanceDefinition(_) => ResourceType::SubstanceDefinition,
            Self::SubstanceNucleicAcid(_) => ResourceType::SubstanceNucleicAcid,
            Self::SubstancePolymer(_) => ResourceType::SubstancePolymer,
            Self::SubstanceProtein(_) => ResourceType::SubstanceProtein,
            Self::SubstanceReferenceInformation(_) => {
                ResourceType::SubstanceReferenceInformation
            }
            Self::SubstanceSourceMaterial(_) => ResourceType::SubstanceSourceMaterial,
            Self::SupplyDelivery(_) => ResourceType::SupplyDelivery,
            Self::SupplyRequest(_) => ResourceType::SupplyRequest,
            Self::Task(_) => ResourceType::Task,
            Self::TerminologyCapabilities(_) => ResourceType::TerminologyCapabilities,
            Self::TestPlan(_) => ResourceType::TestPlan,
            Self::TestReport(_) => ResourceType::TestReport,
            Self::TestScript(_) => ResourceType::TestScript,
            Self::Transport(_) => ResourceType::Transport,
            Self::ValueSet(_) => ResourceType::ValueSet,
            Self::VerificationResult(_) => ResourceType::VerificationResult,
            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::ActorDefinition => stringify!(ActorDefinition),
            Self::AdministrableProductDefinition => {
                stringify!(AdministrableProductDefinition)
            }
            Self::AdverseEvent => stringify!(AdverseEvent),
            Self::AllergyIntolerance => stringify!(AllergyIntolerance),
            Self::Appointment => stringify!(Appointment),
            Self::AppointmentResponse => stringify!(AppointmentResponse),
            Self::ArtifactAssessment => stringify!(ArtifactAssessment),
            Self::AuditEvent => stringify!(AuditEvent),
            Self::Basic => stringify!(Basic),
            Self::Binary => stringify!(Binary),
            Self::BiologicallyDerivedProduct => stringify!(BiologicallyDerivedProduct),
            Self::BiologicallyDerivedProductDispense => {
                stringify!(BiologicallyDerivedProductDispense)
            }
            Self::BodyStructure => stringify!(BodyStructure),
            Self::Bundle => stringify!(Bundle),
            Self::CapabilityStatement => stringify!(CapabilityStatement),
            Self::CarePlan => stringify!(CarePlan),
            Self::CareTeam => stringify!(CareTeam),
            Self::ChargeItem => stringify!(ChargeItem),
            Self::ChargeItemDefinition => stringify!(ChargeItemDefinition),
            Self::Citation => stringify!(Citation),
            Self::Claim => stringify!(Claim),
            Self::ClaimResponse => stringify!(ClaimResponse),
            Self::ClinicalImpression => stringify!(ClinicalImpression),
            Self::ClinicalUseDefinition => stringify!(ClinicalUseDefinition),
            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::ConditionDefinition => stringify!(ConditionDefinition),
            Self::Consent => stringify!(Consent),
            Self::Contract => stringify!(Contract),
            Self::Coverage => stringify!(Coverage),
            Self::CoverageEligibilityRequest => stringify!(CoverageEligibilityRequest),
            Self::CoverageEligibilityResponse => stringify!(CoverageEligibilityResponse),
            Self::DetectedIssue => stringify!(DetectedIssue),
            Self::Device => stringify!(Device),
            Self::DeviceAssociation => stringify!(DeviceAssociation),
            Self::DeviceDefinition => stringify!(DeviceDefinition),
            Self::DeviceDispense => stringify!(DeviceDispense),
            Self::DeviceMetric => stringify!(DeviceMetric),
            Self::DeviceRequest => stringify!(DeviceRequest),
            Self::DeviceUsage => stringify!(DeviceUsage),
            Self::DiagnosticReport => stringify!(DiagnosticReport),
            Self::DocumentReference => stringify!(DocumentReference),
            Self::Encounter => stringify!(Encounter),
            Self::EncounterHistory => stringify!(EncounterHistory),
            Self::Endpoint => stringify!(Endpoint),
            Self::EnrollmentRequest => stringify!(EnrollmentRequest),
            Self::EnrollmentResponse => stringify!(EnrollmentResponse),
            Self::EpisodeOfCare => stringify!(EpisodeOfCare),
            Self::EventDefinition => stringify!(EventDefinition),
            Self::Evidence => stringify!(Evidence),
            Self::EvidenceReport => stringify!(EvidenceReport),
            Self::EvidenceVariable => stringify!(EvidenceVariable),
            Self::ExampleScenario => stringify!(ExampleScenario),
            Self::ExplanationOfBenefit => stringify!(ExplanationOfBenefit),
            Self::FamilyMemberHistory => stringify!(FamilyMemberHistory),
            Self::Flag => stringify!(Flag),
            Self::FormularyItem => stringify!(FormularyItem),
            Self::GenomicStudy => stringify!(GenomicStudy),
            Self::Goal => stringify!(Goal),
            Self::GraphDefinition => stringify!(GraphDefinition),
            Self::Group => stringify!(Group),
            Self::GuidanceResponse => stringify!(GuidanceResponse),
            Self::HealthcareService => stringify!(HealthcareService),
            Self::ImagingSelection => stringify!(ImagingSelection),
            Self::ImagingStudy => stringify!(ImagingStudy),
            Self::Immunization => stringify!(Immunization),
            Self::ImmunizationEvaluation => stringify!(ImmunizationEvaluation),
            Self::ImmunizationRecommendation => stringify!(ImmunizationRecommendation),
            Self::ImplementationGuide => stringify!(ImplementationGuide),
            Self::Ingredient => stringify!(Ingredient),
            Self::InsurancePlan => stringify!(InsurancePlan),
            Self::InventoryItem => stringify!(InventoryItem),
            Self::InventoryReport => stringify!(InventoryReport),
            Self::Invoice => stringify!(Invoice),
            Self::Library => stringify!(Library),
            Self::Linkage => stringify!(Linkage),
            Self::List => stringify!(List),
            Self::Location => stringify!(Location),
            Self::ManufacturedItemDefinition => stringify!(ManufacturedItemDefinition),
            Self::Measure => stringify!(Measure),
            Self::MeasureReport => stringify!(MeasureReport),
            Self::Medication => stringify!(Medication),
            Self::MedicationAdministration => stringify!(MedicationAdministration),
            Self::MedicationDispense => stringify!(MedicationDispense),
            Self::MedicationKnowledge => stringify!(MedicationKnowledge),
            Self::MedicationRequest => stringify!(MedicationRequest),
            Self::MedicationStatement => stringify!(MedicationStatement),
            Self::MedicinalProductDefinition => stringify!(MedicinalProductDefinition),
            Self::MessageDefinition => stringify!(MessageDefinition),
            Self::MessageHeader => stringify!(MessageHeader),
            Self::MolecularSequence => stringify!(MolecularSequence),
            Self::NamingSystem => stringify!(NamingSystem),
            Self::NutritionIntake => stringify!(NutritionIntake),
            Self::NutritionOrder => stringify!(NutritionOrder),
            Self::NutritionProduct => stringify!(NutritionProduct),
            Self::Observation => stringify!(Observation),
            Self::ObservationDefinition => stringify!(ObservationDefinition),
            Self::OperationDefinition => stringify!(OperationDefinition),
            Self::OperationOutcome => stringify!(OperationOutcome),
            Self::Organization => stringify!(Organization),
            Self::OrganizationAffiliation => stringify!(OrganizationAffiliation),
            Self::PackagedProductDefinition => stringify!(PackagedProductDefinition),
            Self::Parameters => stringify!(Parameters),
            Self::Patient => stringify!(Patient),
            Self::PaymentNotice => stringify!(PaymentNotice),
            Self::PaymentReconciliation => stringify!(PaymentReconciliation),
            Self::Permission => stringify!(Permission),
            Self::Person => stringify!(Person),
            Self::PlanDefinition => stringify!(PlanDefinition),
            Self::Practitioner => stringify!(Practitioner),
            Self::PractitionerRole => stringify!(PractitionerRole),
            Self::Procedure => stringify!(Procedure),
            Self::Provenance => stringify!(Provenance),
            Self::Questionnaire => stringify!(Questionnaire),
            Self::QuestionnaireResponse => stringify!(QuestionnaireResponse),
            Self::RegulatedAuthorization => stringify!(RegulatedAuthorization),
            Self::RelatedPerson => stringify!(RelatedPerson),
            Self::RequestOrchestration => stringify!(RequestOrchestration),
            Self::Requirements => stringify!(Requirements),
            Self::ResearchStudy => stringify!(ResearchStudy),
            Self::ResearchSubject => stringify!(ResearchSubject),
            Self::RiskAssessment => stringify!(RiskAssessment),
            Self::Schedule => stringify!(Schedule),
            Self::SearchParameter => stringify!(SearchParameter),
            Self::ServiceRequest => stringify!(ServiceRequest),
            Self::Slot => stringify!(Slot),
            Self::Specimen => stringify!(Specimen),
            Self::SpecimenDefinition => stringify!(SpecimenDefinition),
            Self::StructureDefinition => stringify!(StructureDefinition),
            Self::StructureMap => stringify!(StructureMap),
            Self::Subscription => stringify!(Subscription),
            Self::SubscriptionStatus => stringify!(SubscriptionStatus),
            Self::SubscriptionTopic => stringify!(SubscriptionTopic),
            Self::Substance => stringify!(Substance),
            Self::SubstanceDefinition => stringify!(SubstanceDefinition),
            Self::SubstanceNucleicAcid => stringify!(SubstanceNucleicAcid),
            Self::SubstancePolymer => stringify!(SubstancePolymer),
            Self::SubstanceProtein => stringify!(SubstanceProtein),
            Self::SubstanceReferenceInformation => {
                stringify!(SubstanceReferenceInformation)
            }
            Self::SubstanceSourceMaterial => stringify!(SubstanceSourceMaterial),
            Self::SupplyDelivery => stringify!(SupplyDelivery),
            Self::SupplyRequest => stringify!(SupplyRequest),
            Self::Task => stringify!(Task),
            Self::TerminologyCapabilities => stringify!(TerminologyCapabilities),
            Self::TestPlan => stringify!(TestPlan),
            Self::TestReport => stringify!(TestReport),
            Self::TestScript => stringify!(TestScript),
            Self::Transport => stringify!(Transport),
            Self::ValueSet => stringify!(ValueSet),
            Self::VerificationResult => stringify!(VerificationResult),
            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!(ActorDefinition) => Ok(Self::ActorDefinition),
            stringify!(AdministrableProductDefinition) => {
                Ok(Self::AdministrableProductDefinition)
            }
            stringify!(AdverseEvent) => Ok(Self::AdverseEvent),
            stringify!(AllergyIntolerance) => Ok(Self::AllergyIntolerance),
            stringify!(Appointment) => Ok(Self::Appointment),
            stringify!(AppointmentResponse) => Ok(Self::AppointmentResponse),
            stringify!(ArtifactAssessment) => Ok(Self::ArtifactAssessment),
            stringify!(AuditEvent) => Ok(Self::AuditEvent),
            stringify!(Basic) => Ok(Self::Basic),
            stringify!(Binary) => Ok(Self::Binary),
            stringify!(BiologicallyDerivedProduct) => {
                Ok(Self::BiologicallyDerivedProduct)
            }
            stringify!(BiologicallyDerivedProductDispense) => {
                Ok(Self::BiologicallyDerivedProductDispense)
            }
            stringify!(BodyStructure) => Ok(Self::BodyStructure),
            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!(ChargeItemDefinition) => Ok(Self::ChargeItemDefinition),
            stringify!(Citation) => Ok(Self::Citation),
            stringify!(Claim) => Ok(Self::Claim),
            stringify!(ClaimResponse) => Ok(Self::ClaimResponse),
            stringify!(ClinicalImpression) => Ok(Self::ClinicalImpression),
            stringify!(ClinicalUseDefinition) => Ok(Self::ClinicalUseDefinition),
            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!(ConditionDefinition) => Ok(Self::ConditionDefinition),
            stringify!(Consent) => Ok(Self::Consent),
            stringify!(Contract) => Ok(Self::Contract),
            stringify!(Coverage) => Ok(Self::Coverage),
            stringify!(CoverageEligibilityRequest) => {
                Ok(Self::CoverageEligibilityRequest)
            }
            stringify!(CoverageEligibilityResponse) => {
                Ok(Self::CoverageEligibilityResponse)
            }
            stringify!(DetectedIssue) => Ok(Self::DetectedIssue),
            stringify!(Device) => Ok(Self::Device),
            stringify!(DeviceAssociation) => Ok(Self::DeviceAssociation),
            stringify!(DeviceDefinition) => Ok(Self::DeviceDefinition),
            stringify!(DeviceDispense) => Ok(Self::DeviceDispense),
            stringify!(DeviceMetric) => Ok(Self::DeviceMetric),
            stringify!(DeviceRequest) => Ok(Self::DeviceRequest),
            stringify!(DeviceUsage) => Ok(Self::DeviceUsage),
            stringify!(DiagnosticReport) => Ok(Self::DiagnosticReport),
            stringify!(DocumentReference) => Ok(Self::DocumentReference),
            stringify!(Encounter) => Ok(Self::Encounter),
            stringify!(EncounterHistory) => Ok(Self::EncounterHistory),
            stringify!(Endpoint) => Ok(Self::Endpoint),
            stringify!(EnrollmentRequest) => Ok(Self::EnrollmentRequest),
            stringify!(EnrollmentResponse) => Ok(Self::EnrollmentResponse),
            stringify!(EpisodeOfCare) => Ok(Self::EpisodeOfCare),
            stringify!(EventDefinition) => Ok(Self::EventDefinition),
            stringify!(Evidence) => Ok(Self::Evidence),
            stringify!(EvidenceReport) => Ok(Self::EvidenceReport),
            stringify!(EvidenceVariable) => Ok(Self::EvidenceVariable),
            stringify!(ExampleScenario) => Ok(Self::ExampleScenario),
            stringify!(ExplanationOfBenefit) => Ok(Self::ExplanationOfBenefit),
            stringify!(FamilyMemberHistory) => Ok(Self::FamilyMemberHistory),
            stringify!(Flag) => Ok(Self::Flag),
            stringify!(FormularyItem) => Ok(Self::FormularyItem),
            stringify!(GenomicStudy) => Ok(Self::GenomicStudy),
            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!(ImagingSelection) => Ok(Self::ImagingSelection),
            stringify!(ImagingStudy) => Ok(Self::ImagingStudy),
            stringify!(Immunization) => Ok(Self::Immunization),
            stringify!(ImmunizationEvaluation) => Ok(Self::ImmunizationEvaluation),
            stringify!(ImmunizationRecommendation) => {
                Ok(Self::ImmunizationRecommendation)
            }
            stringify!(ImplementationGuide) => Ok(Self::ImplementationGuide),
            stringify!(Ingredient) => Ok(Self::Ingredient),
            stringify!(InsurancePlan) => Ok(Self::InsurancePlan),
            stringify!(InventoryItem) => Ok(Self::InventoryItem),
            stringify!(InventoryReport) => Ok(Self::InventoryReport),
            stringify!(Invoice) => Ok(Self::Invoice),
            stringify!(Library) => Ok(Self::Library),
            stringify!(Linkage) => Ok(Self::Linkage),
            stringify!(List) => Ok(Self::List),
            stringify!(Location) => Ok(Self::Location),
            stringify!(ManufacturedItemDefinition) => {
                Ok(Self::ManufacturedItemDefinition)
            }
            stringify!(Measure) => Ok(Self::Measure),
            stringify!(MeasureReport) => Ok(Self::MeasureReport),
            stringify!(Medication) => Ok(Self::Medication),
            stringify!(MedicationAdministration) => Ok(Self::MedicationAdministration),
            stringify!(MedicationDispense) => Ok(Self::MedicationDispense),
            stringify!(MedicationKnowledge) => Ok(Self::MedicationKnowledge),
            stringify!(MedicationRequest) => Ok(Self::MedicationRequest),
            stringify!(MedicationStatement) => Ok(Self::MedicationStatement),
            stringify!(MedicinalProductDefinition) => {
                Ok(Self::MedicinalProductDefinition)
            }
            stringify!(MessageDefinition) => Ok(Self::MessageDefinition),
            stringify!(MessageHeader) => Ok(Self::MessageHeader),
            stringify!(MolecularSequence) => Ok(Self::MolecularSequence),
            stringify!(NamingSystem) => Ok(Self::NamingSystem),
            stringify!(NutritionIntake) => Ok(Self::NutritionIntake),
            stringify!(NutritionOrder) => Ok(Self::NutritionOrder),
            stringify!(NutritionProduct) => Ok(Self::NutritionProduct),
            stringify!(Observation) => Ok(Self::Observation),
            stringify!(ObservationDefinition) => Ok(Self::ObservationDefinition),
            stringify!(OperationDefinition) => Ok(Self::OperationDefinition),
            stringify!(OperationOutcome) => Ok(Self::OperationOutcome),
            stringify!(Organization) => Ok(Self::Organization),
            stringify!(OrganizationAffiliation) => Ok(Self::OrganizationAffiliation),
            stringify!(PackagedProductDefinition) => Ok(Self::PackagedProductDefinition),
            stringify!(Parameters) => Ok(Self::Parameters),
            stringify!(Patient) => Ok(Self::Patient),
            stringify!(PaymentNotice) => Ok(Self::PaymentNotice),
            stringify!(PaymentReconciliation) => Ok(Self::PaymentReconciliation),
            stringify!(Permission) => Ok(Self::Permission),
            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!(Provenance) => Ok(Self::Provenance),
            stringify!(Questionnaire) => Ok(Self::Questionnaire),
            stringify!(QuestionnaireResponse) => Ok(Self::QuestionnaireResponse),
            stringify!(RegulatedAuthorization) => Ok(Self::RegulatedAuthorization),
            stringify!(RelatedPerson) => Ok(Self::RelatedPerson),
            stringify!(RequestOrchestration) => Ok(Self::RequestOrchestration),
            stringify!(Requirements) => Ok(Self::Requirements),
            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!(ServiceRequest) => Ok(Self::ServiceRequest),
            stringify!(Slot) => Ok(Self::Slot),
            stringify!(Specimen) => Ok(Self::Specimen),
            stringify!(SpecimenDefinition) => Ok(Self::SpecimenDefinition),
            stringify!(StructureDefinition) => Ok(Self::StructureDefinition),
            stringify!(StructureMap) => Ok(Self::StructureMap),
            stringify!(Subscription) => Ok(Self::Subscription),
            stringify!(SubscriptionStatus) => Ok(Self::SubscriptionStatus),
            stringify!(SubscriptionTopic) => Ok(Self::SubscriptionTopic),
            stringify!(Substance) => Ok(Self::Substance),
            stringify!(SubstanceDefinition) => Ok(Self::SubstanceDefinition),
            stringify!(SubstanceNucleicAcid) => Ok(Self::SubstanceNucleicAcid),
            stringify!(SubstancePolymer) => Ok(Self::SubstancePolymer),
            stringify!(SubstanceProtein) => Ok(Self::SubstanceProtein),
            stringify!(SubstanceReferenceInformation) => {
                Ok(Self::SubstanceReferenceInformation)
            }
            stringify!(SubstanceSourceMaterial) => Ok(Self::SubstanceSourceMaterial),
            stringify!(SupplyDelivery) => Ok(Self::SupplyDelivery),
            stringify!(SupplyRequest) => Ok(Self::SupplyRequest),
            stringify!(Task) => Ok(Self::Task),
            stringify!(TerminologyCapabilities) => Ok(Self::TerminologyCapabilities),
            stringify!(TestPlan) => Ok(Self::TestPlan),
            stringify!(TestReport) => Ok(Self::TestReport),
            stringify!(TestScript) => Ok(Self::TestScript),
            stringify!(Transport) => Ok(Self::Transport),
            stringify!(ValueSet) => Ok(Self::ValueSet),
            stringify!(VerificationResult) => Ok(Self::VerificationResult),
            stringify!(VisionPrescription) => Ok(Self::VisionPrescription),
            _ => Err(format!("Unknown value: {s}")),
        }
    }
}
/** This is the base resource type for everything.

 **Resource v5.0.0**

 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 ActorDefinition {
    #[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 AdministrableProductDefinition {
    #[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 ArtifactAssessment {
    #[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 BiologicallyDerivedProduct {
    #[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 BiologicallyDerivedProductDispense {
    #[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 BodyStructure {
    #[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 ChargeItemDefinition {
    #[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 Citation {
    #[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 ClinicalUseDefinition {
    #[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 ConditionDefinition {
    #[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 CoverageEligibilityRequest {
    #[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 CoverageEligibilityResponse {
    #[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 DeviceAssociation {
    #[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 DeviceDefinition {
    #[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 DeviceDispense {
    #[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 DeviceUsage {
    #[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 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 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 EncounterHistory {
    #[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 EventDefinition {
    #[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 Evidence {
    #[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 EvidenceReport {
    #[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 EvidenceVariable {
    #[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 ExampleScenario {
    #[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 FormularyItem {
    #[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 GenomicStudy {
    #[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 ImagingSelection {
    #[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 ImmunizationEvaluation {
    #[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 Ingredient {
    #[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 InsurancePlan {
    #[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 InventoryItem {
    #[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 InventoryReport {
    #[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 Invoice {
    #[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 ManufacturedItemDefinition {
    #[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 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 MedicationKnowledge {
    #[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 MedicinalProductDefinition {
    #[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 MolecularSequence {
    #[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 NutritionIntake {
    #[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 NutritionProduct {
    #[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 ObservationDefinition {
    #[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 OrganizationAffiliation {
    #[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 PackagedProductDefinition {
    #[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 Permission {
    #[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 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 RegulatedAuthorization {
    #[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 RequestOrchestration {
    #[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 Requirements {
    #[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 ServiceRequest {
    #[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 SpecimenDefinition {
    #[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 SubscriptionStatus {
    #[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 SubscriptionTopic {
    #[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 SubstanceDefinition {
    #[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 SubstanceNucleicAcid {
    #[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 SubstancePolymer {
    #[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 SubstanceProtein {
    #[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 SubstanceReferenceInformation {
    #[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 SubstanceSourceMaterial {
    #[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 TerminologyCapabilities {
    #[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 TestPlan {
    #[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 Transport {
    #[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 VerificationResult {
    #[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::ActorDefinition(r) => r,
            Self::AdministrableProductDefinition(r) => r,
            Self::AdverseEvent(r) => r,
            Self::AllergyIntolerance(r) => r,
            Self::Appointment(r) => r,
            Self::AppointmentResponse(r) => r,
            Self::ArtifactAssessment(r) => r,
            Self::AuditEvent(r) => r,
            Self::Basic(r) => r,
            Self::Binary(r) => r,
            Self::BiologicallyDerivedProduct(r) => r,
            Self::BiologicallyDerivedProductDispense(r) => r,
            Self::BodyStructure(r) => r,
            Self::Bundle(r) => r,
            Self::CapabilityStatement(r) => r,
            Self::CarePlan(r) => r,
            Self::CareTeam(r) => r,
            Self::ChargeItem(r) => r,
            Self::ChargeItemDefinition(r) => r,
            Self::Citation(r) => r,
            Self::Claim(r) => r,
            Self::ClaimResponse(r) => r,
            Self::ClinicalImpression(r) => r,
            Self::ClinicalUseDefinition(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::ConditionDefinition(r) => r,
            Self::Consent(r) => r,
            Self::Contract(r) => r,
            Self::Coverage(r) => r,
            Self::CoverageEligibilityRequest(r) => r,
            Self::CoverageEligibilityResponse(r) => r,
            Self::DetectedIssue(r) => r,
            Self::Device(r) => r,
            Self::DeviceAssociation(r) => r,
            Self::DeviceDefinition(r) => r,
            Self::DeviceDispense(r) => r,
            Self::DeviceMetric(r) => r,
            Self::DeviceRequest(r) => r,
            Self::DeviceUsage(r) => r,
            Self::DiagnosticReport(r) => r,
            Self::DocumentReference(r) => r,
            Self::Encounter(r) => r,
            Self::EncounterHistory(r) => r,
            Self::Endpoint(r) => r,
            Self::EnrollmentRequest(r) => r,
            Self::EnrollmentResponse(r) => r,
            Self::EpisodeOfCare(r) => r,
            Self::EventDefinition(r) => r,
            Self::Evidence(r) => r,
            Self::EvidenceReport(r) => r,
            Self::EvidenceVariable(r) => r,
            Self::ExampleScenario(r) => r,
            Self::ExplanationOfBenefit(r) => r,
            Self::FamilyMemberHistory(r) => r,
            Self::Flag(r) => r,
            Self::FormularyItem(r) => r,
            Self::GenomicStudy(r) => r,
            Self::Goal(r) => r,
            Self::GraphDefinition(r) => r,
            Self::Group(r) => r,
            Self::GuidanceResponse(r) => r,
            Self::HealthcareService(r) => r,
            Self::ImagingSelection(r) => r,
            Self::ImagingStudy(r) => r,
            Self::Immunization(r) => r,
            Self::ImmunizationEvaluation(r) => r,
            Self::ImmunizationRecommendation(r) => r,
            Self::ImplementationGuide(r) => r,
            Self::Ingredient(r) => r,
            Self::InsurancePlan(r) => r,
            Self::InventoryItem(r) => r,
            Self::InventoryReport(r) => r,
            Self::Invoice(r) => r,
            Self::Library(r) => r,
            Self::Linkage(r) => r,
            Self::List(r) => r,
            Self::Location(r) => r,
            Self::ManufacturedItemDefinition(r) => r,
            Self::Measure(r) => r,
            Self::MeasureReport(r) => r,
            Self::Medication(r) => r,
            Self::MedicationAdministration(r) => r,
            Self::MedicationDispense(r) => r,
            Self::MedicationKnowledge(r) => r,
            Self::MedicationRequest(r) => r,
            Self::MedicationStatement(r) => r,
            Self::MedicinalProductDefinition(r) => r,
            Self::MessageDefinition(r) => r,
            Self::MessageHeader(r) => r,
            Self::MolecularSequence(r) => r,
            Self::NamingSystem(r) => r,
            Self::NutritionIntake(r) => r,
            Self::NutritionOrder(r) => r,
            Self::NutritionProduct(r) => r,
            Self::Observation(r) => r,
            Self::ObservationDefinition(r) => r,
            Self::OperationDefinition(r) => r,
            Self::OperationOutcome(r) => r,
            Self::Organization(r) => r,
            Self::OrganizationAffiliation(r) => r,
            Self::PackagedProductDefinition(r) => r,
            Self::Parameters(r) => r,
            Self::Patient(r) => r,
            Self::PaymentNotice(r) => r,
            Self::PaymentReconciliation(r) => r,
            Self::Permission(r) => r,
            Self::Person(r) => r,
            Self::PlanDefinition(r) => r,
            Self::Practitioner(r) => r,
            Self::PractitionerRole(r) => r,
            Self::Procedure(r) => r,
            Self::Provenance(r) => r,
            Self::Questionnaire(r) => r,
            Self::QuestionnaireResponse(r) => r,
            Self::RegulatedAuthorization(r) => r,
            Self::RelatedPerson(r) => r,
            Self::RequestOrchestration(r) => r,
            Self::Requirements(r) => r,
            Self::ResearchStudy(r) => r,
            Self::ResearchSubject(r) => r,
            Self::RiskAssessment(r) => r,
            Self::Schedule(r) => r,
            Self::SearchParameter(r) => r,
            Self::ServiceRequest(r) => r,
            Self::Slot(r) => r,
            Self::Specimen(r) => r,
            Self::SpecimenDefinition(r) => r,
            Self::StructureDefinition(r) => r,
            Self::StructureMap(r) => r,
            Self::Subscription(r) => r,
            Self::SubscriptionStatus(r) => r,
            Self::SubscriptionTopic(r) => r,
            Self::Substance(r) => r,
            Self::SubstanceDefinition(r) => r,
            Self::SubstanceNucleicAcid(r) => r,
            Self::SubstancePolymer(r) => r,
            Self::SubstanceProtein(r) => r,
            Self::SubstanceReferenceInformation(r) => r,
            Self::SubstanceSourceMaterial(r) => r,
            Self::SupplyDelivery(r) => r,
            Self::SupplyRequest(r) => r,
            Self::Task(r) => r,
            Self::TerminologyCapabilities(r) => r,
            Self::TestPlan(r) => r,
            Self::TestReport(r) => r,
            Self::TestScript(r) => r,
            Self::Transport(r) => r,
            Self::ValueSet(r) => r,
            Self::VerificationResult(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::ActorDefinition(r) => r,
            Self::AdministrableProductDefinition(r) => r,
            Self::AdverseEvent(r) => r,
            Self::AllergyIntolerance(r) => r,
            Self::Appointment(r) => r,
            Self::AppointmentResponse(r) => r,
            Self::ArtifactAssessment(r) => r,
            Self::AuditEvent(r) => r,
            Self::Basic(r) => r,
            Self::Binary(r) => r,
            Self::BiologicallyDerivedProduct(r) => r,
            Self::BiologicallyDerivedProductDispense(r) => r,
            Self::BodyStructure(r) => r,
            Self::Bundle(r) => r,
            Self::CapabilityStatement(r) => r,
            Self::CarePlan(r) => r,
            Self::CareTeam(r) => r,
            Self::ChargeItem(r) => r,
            Self::ChargeItemDefinition(r) => r,
            Self::Citation(r) => r,
            Self::Claim(r) => r,
            Self::ClaimResponse(r) => r,
            Self::ClinicalImpression(r) => r,
            Self::ClinicalUseDefinition(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::ConditionDefinition(r) => r,
            Self::Consent(r) => r,
            Self::Contract(r) => r,
            Self::Coverage(r) => r,
            Self::CoverageEligibilityRequest(r) => r,
            Self::CoverageEligibilityResponse(r) => r,
            Self::DetectedIssue(r) => r,
            Self::Device(r) => r,
            Self::DeviceAssociation(r) => r,
            Self::DeviceDefinition(r) => r,
            Self::DeviceDispense(r) => r,
            Self::DeviceMetric(r) => r,
            Self::DeviceRequest(r) => r,
            Self::DeviceUsage(r) => r,
            Self::DiagnosticReport(r) => r,
            Self::DocumentReference(r) => r,
            Self::Encounter(r) => r,
            Self::EncounterHistory(r) => r,
            Self::Endpoint(r) => r,
            Self::EnrollmentRequest(r) => r,
            Self::EnrollmentResponse(r) => r,
            Self::EpisodeOfCare(r) => r,
            Self::EventDefinition(r) => r,
            Self::Evidence(r) => r,
            Self::EvidenceReport(r) => r,
            Self::EvidenceVariable(r) => r,
            Self::ExampleScenario(r) => r,
            Self::ExplanationOfBenefit(r) => r,
            Self::FamilyMemberHistory(r) => r,
            Self::Flag(r) => r,
            Self::FormularyItem(r) => r,
            Self::GenomicStudy(r) => r,
            Self::Goal(r) => r,
            Self::GraphDefinition(r) => r,
            Self::Group(r) => r,
            Self::GuidanceResponse(r) => r,
            Self::HealthcareService(r) => r,
            Self::ImagingSelection(r) => r,
            Self::ImagingStudy(r) => r,
            Self::Immunization(r) => r,
            Self::ImmunizationEvaluation(r) => r,
            Self::ImmunizationRecommendation(r) => r,
            Self::ImplementationGuide(r) => r,
            Self::Ingredient(r) => r,
            Self::InsurancePlan(r) => r,
            Self::InventoryItem(r) => r,
            Self::InventoryReport(r) => r,
            Self::Invoice(r) => r,
            Self::Library(r) => r,
            Self::Linkage(r) => r,
            Self::List(r) => r,
            Self::Location(r) => r,
            Self::ManufacturedItemDefinition(r) => r,
            Self::Measure(r) => r,
            Self::MeasureReport(r) => r,
            Self::Medication(r) => r,
            Self::MedicationAdministration(r) => r,
            Self::MedicationDispense(r) => r,
            Self::MedicationKnowledge(r) => r,
            Self::MedicationRequest(r) => r,
            Self::MedicationStatement(r) => r,
            Self::MedicinalProductDefinition(r) => r,
            Self::MessageDefinition(r) => r,
            Self::MessageHeader(r) => r,
            Self::MolecularSequence(r) => r,
            Self::NamingSystem(r) => r,
            Self::NutritionIntake(r) => r,
            Self::NutritionOrder(r) => r,
            Self::NutritionProduct(r) => r,
            Self::Observation(r) => r,
            Self::ObservationDefinition(r) => r,
            Self::OperationDefinition(r) => r,
            Self::OperationOutcome(r) => r,
            Self::Organization(r) => r,
            Self::OrganizationAffiliation(r) => r,
            Self::PackagedProductDefinition(r) => r,
            Self::Parameters(r) => r,
            Self::Patient(r) => r,
            Self::PaymentNotice(r) => r,
            Self::PaymentReconciliation(r) => r,
            Self::Permission(r) => r,
            Self::Person(r) => r,
            Self::PlanDefinition(r) => r,
            Self::Practitioner(r) => r,
            Self::PractitionerRole(r) => r,
            Self::Procedure(r) => r,
            Self::Provenance(r) => r,
            Self::Questionnaire(r) => r,
            Self::QuestionnaireResponse(r) => r,
            Self::RegulatedAuthorization(r) => r,
            Self::RelatedPerson(r) => r,
            Self::RequestOrchestration(r) => r,
            Self::Requirements(r) => r,
            Self::ResearchStudy(r) => r,
            Self::ResearchSubject(r) => r,
            Self::RiskAssessment(r) => r,
            Self::Schedule(r) => r,
            Self::SearchParameter(r) => r,
            Self::ServiceRequest(r) => r,
            Self::Slot(r) => r,
            Self::Specimen(r) => r,
            Self::SpecimenDefinition(r) => r,
            Self::StructureDefinition(r) => r,
            Self::StructureMap(r) => r,
            Self::Subscription(r) => r,
            Self::SubscriptionStatus(r) => r,
            Self::SubscriptionTopic(r) => r,
            Self::Substance(r) => r,
            Self::SubstanceDefinition(r) => r,
            Self::SubstanceNucleicAcid(r) => r,
            Self::SubstancePolymer(r) => r,
            Self::SubstanceProtein(r) => r,
            Self::SubstanceReferenceInformation(r) => r,
            Self::SubstanceSourceMaterial(r) => r,
            Self::SupplyDelivery(r) => r,
            Self::SupplyRequest(r) => r,
            Self::Task(r) => r,
            Self::TerminologyCapabilities(r) => r,
            Self::TestPlan(r) => r,
            Self::TestReport(r) => r,
            Self::TestScript(r) => r,
            Self::Transport(r) => r,
            Self::ValueSet(r) => r,
            Self::VerificationResult(r) => r,
            Self::VisionPrescription(r) => r,
        }
    }
}
/** A resource that includes narrative, extensions, and contained resources.

 **DomainResource v5.0.0**

 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 ActorDefinition {
    #[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 AdministrableProductDefinition {
    #[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 ArtifactAssessment {
    #[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 BiologicallyDerivedProduct {
    #[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 BiologicallyDerivedProductDispense {
    #[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 BodyStructure {
    #[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 ChargeItemDefinition {
    #[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 Citation {
    #[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 ClinicalUseDefinition {
    #[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 ConditionDefinition {
    #[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 CoverageEligibilityRequest {
    #[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 CoverageEligibilityResponse {
    #[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 DeviceAssociation {
    #[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 DeviceDefinition {
    #[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 DeviceDispense {
    #[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 DeviceUsage {
    #[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 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 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 EncounterHistory {
    #[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 EventDefinition {
    #[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 Evidence {
    #[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 EvidenceReport {
    #[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 EvidenceVariable {
    #[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 ExampleScenario {
    #[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 FormularyItem {
    #[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 GenomicStudy {
    #[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 ImagingSelection {
    #[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 ImmunizationEvaluation {
    #[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 Ingredient {
    #[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 InsurancePlan {
    #[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 InventoryItem {
    #[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 InventoryReport {
    #[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 Invoice {
    #[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 ManufacturedItemDefinition {
    #[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 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 MedicationKnowledge {
    #[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 MedicinalProductDefinition {
    #[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 MolecularSequence {
    #[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 NutritionIntake {
    #[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 NutritionProduct {
    #[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 ObservationDefinition {
    #[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 OrganizationAffiliation {
    #[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 PackagedProductDefinition {
    #[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 Permission {
    #[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 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 RegulatedAuthorization {
    #[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 RequestOrchestration {
    #[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 Requirements {
    #[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 ServiceRequest {
    #[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 SpecimenDefinition {
    #[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 SubscriptionStatus {
    #[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 SubscriptionTopic {
    #[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 SubstanceDefinition {
    #[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 SubstanceNucleicAcid {
    #[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 SubstancePolymer {
    #[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 SubstanceProtein {
    #[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 SubstanceReferenceInformation {
    #[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 SubstanceSourceMaterial {
    #[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 TerminologyCapabilities {
    #[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 TestPlan {
    #[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 Transport {
    #[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 VerificationResult {
    #[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::ActorDefinition(r) => Some(r),
            Self::AdministrableProductDefinition(r) => Some(r),
            Self::AdverseEvent(r) => Some(r),
            Self::AllergyIntolerance(r) => Some(r),
            Self::Appointment(r) => Some(r),
            Self::AppointmentResponse(r) => Some(r),
            Self::ArtifactAssessment(r) => Some(r),
            Self::AuditEvent(r) => Some(r),
            Self::Basic(r) => Some(r),
            Self::BiologicallyDerivedProduct(r) => Some(r),
            Self::BiologicallyDerivedProductDispense(r) => Some(r),
            Self::BodyStructure(r) => Some(r),
            Self::CapabilityStatement(r) => Some(r),
            Self::CarePlan(r) => Some(r),
            Self::CareTeam(r) => Some(r),
            Self::ChargeItem(r) => Some(r),
            Self::ChargeItemDefinition(r) => Some(r),
            Self::Citation(r) => Some(r),
            Self::Claim(r) => Some(r),
            Self::ClaimResponse(r) => Some(r),
            Self::ClinicalImpression(r) => Some(r),
            Self::ClinicalUseDefinition(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::ConditionDefinition(r) => Some(r),
            Self::Consent(r) => Some(r),
            Self::Contract(r) => Some(r),
            Self::Coverage(r) => Some(r),
            Self::CoverageEligibilityRequest(r) => Some(r),
            Self::CoverageEligibilityResponse(r) => Some(r),
            Self::DetectedIssue(r) => Some(r),
            Self::Device(r) => Some(r),
            Self::DeviceAssociation(r) => Some(r),
            Self::DeviceDefinition(r) => Some(r),
            Self::DeviceDispense(r) => Some(r),
            Self::DeviceMetric(r) => Some(r),
            Self::DeviceRequest(r) => Some(r),
            Self::DeviceUsage(r) => Some(r),
            Self::DiagnosticReport(r) => Some(r),
            Self::DocumentReference(r) => Some(r),
            Self::Encounter(r) => Some(r),
            Self::EncounterHistory(r) => Some(r),
            Self::Endpoint(r) => Some(r),
            Self::EnrollmentRequest(r) => Some(r),
            Self::EnrollmentResponse(r) => Some(r),
            Self::EpisodeOfCare(r) => Some(r),
            Self::EventDefinition(r) => Some(r),
            Self::Evidence(r) => Some(r),
            Self::EvidenceReport(r) => Some(r),
            Self::EvidenceVariable(r) => Some(r),
            Self::ExampleScenario(r) => Some(r),
            Self::ExplanationOfBenefit(r) => Some(r),
            Self::FamilyMemberHistory(r) => Some(r),
            Self::Flag(r) => Some(r),
            Self::FormularyItem(r) => Some(r),
            Self::GenomicStudy(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::ImagingSelection(r) => Some(r),
            Self::ImagingStudy(r) => Some(r),
            Self::Immunization(r) => Some(r),
            Self::ImmunizationEvaluation(r) => Some(r),
            Self::ImmunizationRecommendation(r) => Some(r),
            Self::ImplementationGuide(r) => Some(r),
            Self::Ingredient(r) => Some(r),
            Self::InsurancePlan(r) => Some(r),
            Self::InventoryItem(r) => Some(r),
            Self::InventoryReport(r) => Some(r),
            Self::Invoice(r) => Some(r),
            Self::Library(r) => Some(r),
            Self::Linkage(r) => Some(r),
            Self::List(r) => Some(r),
            Self::Location(r) => Some(r),
            Self::ManufacturedItemDefinition(r) => Some(r),
            Self::Measure(r) => Some(r),
            Self::MeasureReport(r) => Some(r),
            Self::Medication(r) => Some(r),
            Self::MedicationAdministration(r) => Some(r),
            Self::MedicationDispense(r) => Some(r),
            Self::MedicationKnowledge(r) => Some(r),
            Self::MedicationRequest(r) => Some(r),
            Self::MedicationStatement(r) => Some(r),
            Self::MedicinalProductDefinition(r) => Some(r),
            Self::MessageDefinition(r) => Some(r),
            Self::MessageHeader(r) => Some(r),
            Self::MolecularSequence(r) => Some(r),
            Self::NamingSystem(r) => Some(r),
            Self::NutritionIntake(r) => Some(r),
            Self::NutritionOrder(r) => Some(r),
            Self::NutritionProduct(r) => Some(r),
            Self::Observation(r) => Some(r),
            Self::ObservationDefinition(r) => Some(r),
            Self::OperationDefinition(r) => Some(r),
            Self::OperationOutcome(r) => Some(r),
            Self::Organization(r) => Some(r),
            Self::OrganizationAffiliation(r) => Some(r),
            Self::PackagedProductDefinition(r) => Some(r),
            Self::Patient(r) => Some(r),
            Self::PaymentNotice(r) => Some(r),
            Self::PaymentReconciliation(r) => Some(r),
            Self::Permission(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::Provenance(r) => Some(r),
            Self::Questionnaire(r) => Some(r),
            Self::QuestionnaireResponse(r) => Some(r),
            Self::RegulatedAuthorization(r) => Some(r),
            Self::RelatedPerson(r) => Some(r),
            Self::RequestOrchestration(r) => Some(r),
            Self::Requirements(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::ServiceRequest(r) => Some(r),
            Self::Slot(r) => Some(r),
            Self::Specimen(r) => Some(r),
            Self::SpecimenDefinition(r) => Some(r),
            Self::StructureDefinition(r) => Some(r),
            Self::StructureMap(r) => Some(r),
            Self::Subscription(r) => Some(r),
            Self::SubscriptionStatus(r) => Some(r),
            Self::SubscriptionTopic(r) => Some(r),
            Self::Substance(r) => Some(r),
            Self::SubstanceDefinition(r) => Some(r),
            Self::SubstanceNucleicAcid(r) => Some(r),
            Self::SubstancePolymer(r) => Some(r),
            Self::SubstanceProtein(r) => Some(r),
            Self::SubstanceReferenceInformation(r) => Some(r),
            Self::SubstanceSourceMaterial(r) => Some(r),
            Self::SupplyDelivery(r) => Some(r),
            Self::SupplyRequest(r) => Some(r),
            Self::Task(r) => Some(r),
            Self::TerminologyCapabilities(r) => Some(r),
            Self::TestPlan(r) => Some(r),
            Self::TestReport(r) => Some(r),
            Self::TestScript(r) => Some(r),
            Self::Transport(r) => Some(r),
            Self::ValueSet(r) => Some(r),
            Self::VerificationResult(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::ActorDefinition(r) => Some(r),
            Self::AdministrableProductDefinition(r) => Some(r),
            Self::AdverseEvent(r) => Some(r),
            Self::AllergyIntolerance(r) => Some(r),
            Self::Appointment(r) => Some(r),
            Self::AppointmentResponse(r) => Some(r),
            Self::ArtifactAssessment(r) => Some(r),
            Self::AuditEvent(r) => Some(r),
            Self::Basic(r) => Some(r),
            Self::BiologicallyDerivedProduct(r) => Some(r),
            Self::BiologicallyDerivedProductDispense(r) => Some(r),
            Self::BodyStructure(r) => Some(r),
            Self::CapabilityStatement(r) => Some(r),
            Self::CarePlan(r) => Some(r),
            Self::CareTeam(r) => Some(r),
            Self::ChargeItem(r) => Some(r),
            Self::ChargeItemDefinition(r) => Some(r),
            Self::Citation(r) => Some(r),
            Self::Claim(r) => Some(r),
            Self::ClaimResponse(r) => Some(r),
            Self::ClinicalImpression(r) => Some(r),
            Self::ClinicalUseDefinition(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::ConditionDefinition(r) => Some(r),
            Self::Consent(r) => Some(r),
            Self::Contract(r) => Some(r),
            Self::Coverage(r) => Some(r),
            Self::CoverageEligibilityRequest(r) => Some(r),
            Self::CoverageEligibilityResponse(r) => Some(r),
            Self::DetectedIssue(r) => Some(r),
            Self::Device(r) => Some(r),
            Self::DeviceAssociation(r) => Some(r),
            Self::DeviceDefinition(r) => Some(r),
            Self::DeviceDispense(r) => Some(r),
            Self::DeviceMetric(r) => Some(r),
            Self::DeviceRequest(r) => Some(r),
            Self::DeviceUsage(r) => Some(r),
            Self::DiagnosticReport(r) => Some(r),
            Self::DocumentReference(r) => Some(r),
            Self::Encounter(r) => Some(r),
            Self::EncounterHistory(r) => Some(r),
            Self::Endpoint(r) => Some(r),
            Self::EnrollmentRequest(r) => Some(r),
            Self::EnrollmentResponse(r) => Some(r),
            Self::EpisodeOfCare(r) => Some(r),
            Self::EventDefinition(r) => Some(r),
            Self::Evidence(r) => Some(r),
            Self::EvidenceReport(r) => Some(r),
            Self::EvidenceVariable(r) => Some(r),
            Self::ExampleScenario(r) => Some(r),
            Self::ExplanationOfBenefit(r) => Some(r),
            Self::FamilyMemberHistory(r) => Some(r),
            Self::Flag(r) => Some(r),
            Self::FormularyItem(r) => Some(r),
            Self::GenomicStudy(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::ImagingSelection(r) => Some(r),
            Self::ImagingStudy(r) => Some(r),
            Self::Immunization(r) => Some(r),
            Self::ImmunizationEvaluation(r) => Some(r),
            Self::ImmunizationRecommendation(r) => Some(r),
            Self::ImplementationGuide(r) => Some(r),
            Self::Ingredient(r) => Some(r),
            Self::InsurancePlan(r) => Some(r),
            Self::InventoryItem(r) => Some(r),
            Self::InventoryReport(r) => Some(r),
            Self::Invoice(r) => Some(r),
            Self::Library(r) => Some(r),
            Self::Linkage(r) => Some(r),
            Self::List(r) => Some(r),
            Self::Location(r) => Some(r),
            Self::ManufacturedItemDefinition(r) => Some(r),
            Self::Measure(r) => Some(r),
            Self::MeasureReport(r) => Some(r),
            Self::Medication(r) => Some(r),
            Self::MedicationAdministration(r) => Some(r),
            Self::MedicationDispense(r) => Some(r),
            Self::MedicationKnowledge(r) => Some(r),
            Self::MedicationRequest(r) => Some(r),
            Self::MedicationStatement(r) => Some(r),
            Self::MedicinalProductDefinition(r) => Some(r),
            Self::MessageDefinition(r) => Some(r),
            Self::MessageHeader(r) => Some(r),
            Self::MolecularSequence(r) => Some(r),
            Self::NamingSystem(r) => Some(r),
            Self::NutritionIntake(r) => Some(r),
            Self::NutritionOrder(r) => Some(r),
            Self::NutritionProduct(r) => Some(r),
            Self::Observation(r) => Some(r),
            Self::ObservationDefinition(r) => Some(r),
            Self::OperationDefinition(r) => Some(r),
            Self::OperationOutcome(r) => Some(r),
            Self::Organization(r) => Some(r),
            Self::OrganizationAffiliation(r) => Some(r),
            Self::PackagedProductDefinition(r) => Some(r),
            Self::Patient(r) => Some(r),
            Self::PaymentNotice(r) => Some(r),
            Self::PaymentReconciliation(r) => Some(r),
            Self::Permission(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::Provenance(r) => Some(r),
            Self::Questionnaire(r) => Some(r),
            Self::QuestionnaireResponse(r) => Some(r),
            Self::RegulatedAuthorization(r) => Some(r),
            Self::RelatedPerson(r) => Some(r),
            Self::RequestOrchestration(r) => Some(r),
            Self::Requirements(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::ServiceRequest(r) => Some(r),
            Self::Slot(r) => Some(r),
            Self::Specimen(r) => Some(r),
            Self::SpecimenDefinition(r) => Some(r),
            Self::StructureDefinition(r) => Some(r),
            Self::StructureMap(r) => Some(r),
            Self::Subscription(r) => Some(r),
            Self::SubscriptionStatus(r) => Some(r),
            Self::SubscriptionTopic(r) => Some(r),
            Self::Substance(r) => Some(r),
            Self::SubstanceDefinition(r) => Some(r),
            Self::SubstanceNucleicAcid(r) => Some(r),
            Self::SubstancePolymer(r) => Some(r),
            Self::SubstanceProtein(r) => Some(r),
            Self::SubstanceReferenceInformation(r) => Some(r),
            Self::SubstanceSourceMaterial(r) => Some(r),
            Self::SupplyDelivery(r) => Some(r),
            Self::SupplyRequest(r) => Some(r),
            Self::Task(r) => Some(r),
            Self::TerminologyCapabilities(r) => Some(r),
            Self::TestPlan(r) => Some(r),
            Self::TestReport(r) => Some(r),
            Self::TestScript(r) => Some(r),
            Self::Transport(r) => Some(r),
            Self::ValueSet(r) => Some(r),
            Self::VerificationResult(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 = "5.0.0";
    const TYPE: ResourceType = ResourceType::Account;
}
impl NamedResource for ActivityDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ActivityDefinition;
}
impl NamedResource for ActorDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ActorDefinition;
}
impl NamedResource for AdministrableProductDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::AdministrableProductDefinition;
}
impl NamedResource for AdverseEvent {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::AdverseEvent;
}
impl NamedResource for AllergyIntolerance {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::AllergyIntolerance;
}
impl NamedResource for Appointment {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Appointment;
}
impl NamedResource for AppointmentResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::AppointmentResponse;
}
impl NamedResource for ArtifactAssessment {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ArtifactAssessment;
}
impl NamedResource for AuditEvent {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::AuditEvent;
}
impl NamedResource for Basic {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Basic;
}
impl NamedResource for Binary {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Binary;
}
impl NamedResource for BiologicallyDerivedProduct {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::BiologicallyDerivedProduct;
}
impl NamedResource for BiologicallyDerivedProductDispense {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::BiologicallyDerivedProductDispense;
}
impl NamedResource for BodyStructure {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::BodyStructure;
}
impl NamedResource for Bundle {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Bundle;
}
impl NamedResource for CapabilityStatement {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CapabilityStatement;
}
impl NamedResource for CarePlan {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CarePlan;
}
impl NamedResource for CareTeam {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CareTeam;
}
impl NamedResource for ChargeItem {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ChargeItem;
}
impl NamedResource for ChargeItemDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ChargeItemDefinition;
}
impl NamedResource for Citation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Citation;
}
impl NamedResource for Claim {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Claim;
}
impl NamedResource for ClaimResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ClaimResponse;
}
impl NamedResource for ClinicalImpression {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ClinicalImpression;
}
impl NamedResource for ClinicalUseDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ClinicalUseDefinition;
}
impl NamedResource for CodeSystem {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CodeSystem;
}
impl NamedResource for Communication {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Communication;
}
impl NamedResource for CommunicationRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CommunicationRequest;
}
impl NamedResource for CompartmentDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CompartmentDefinition;
}
impl NamedResource for Composition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Composition;
}
impl NamedResource for ConceptMap {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ConceptMap;
}
impl NamedResource for Condition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Condition;
}
impl NamedResource for ConditionDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ConditionDefinition;
}
impl NamedResource for Consent {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Consent;
}
impl NamedResource for Contract {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Contract;
}
impl NamedResource for Coverage {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Coverage;
}
impl NamedResource for CoverageEligibilityRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CoverageEligibilityRequest;
}
impl NamedResource for CoverageEligibilityResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::CoverageEligibilityResponse;
}
impl NamedResource for DetectedIssue {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DetectedIssue;
}
impl NamedResource for Device {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Device;
}
impl NamedResource for DeviceAssociation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceAssociation;
}
impl NamedResource for DeviceDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceDefinition;
}
impl NamedResource for DeviceDispense {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceDispense;
}
impl NamedResource for DeviceMetric {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceMetric;
}
impl NamedResource for DeviceRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceRequest;
}
impl NamedResource for DeviceUsage {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DeviceUsage;
}
impl NamedResource for DiagnosticReport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DiagnosticReport;
}
impl NamedResource for DocumentReference {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::DocumentReference;
}
impl NamedResource for Encounter {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Encounter;
}
impl NamedResource for EncounterHistory {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EncounterHistory;
}
impl NamedResource for Endpoint {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Endpoint;
}
impl NamedResource for EnrollmentRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EnrollmentRequest;
}
impl NamedResource for EnrollmentResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EnrollmentResponse;
}
impl NamedResource for EpisodeOfCare {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EpisodeOfCare;
}
impl NamedResource for EventDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EventDefinition;
}
impl NamedResource for Evidence {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Evidence;
}
impl NamedResource for EvidenceReport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EvidenceReport;
}
impl NamedResource for EvidenceVariable {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::EvidenceVariable;
}
impl NamedResource for ExampleScenario {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ExampleScenario;
}
impl NamedResource for ExplanationOfBenefit {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ExplanationOfBenefit;
}
impl NamedResource for FamilyMemberHistory {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::FamilyMemberHistory;
}
impl NamedResource for Flag {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Flag;
}
impl NamedResource for FormularyItem {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::FormularyItem;
}
impl NamedResource for GenomicStudy {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::GenomicStudy;
}
impl NamedResource for Goal {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Goal;
}
impl NamedResource for GraphDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::GraphDefinition;
}
impl NamedResource for Group {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Group;
}
impl NamedResource for GuidanceResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::GuidanceResponse;
}
impl NamedResource for HealthcareService {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::HealthcareService;
}
impl NamedResource for ImagingSelection {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ImagingSelection;
}
impl NamedResource for ImagingStudy {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ImagingStudy;
}
impl NamedResource for Immunization {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Immunization;
}
impl NamedResource for ImmunizationEvaluation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ImmunizationEvaluation;
}
impl NamedResource for ImmunizationRecommendation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ImmunizationRecommendation;
}
impl NamedResource for ImplementationGuide {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ImplementationGuide;
}
impl NamedResource for Ingredient {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Ingredient;
}
impl NamedResource for InsurancePlan {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::InsurancePlan;
}
impl NamedResource for InventoryItem {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::InventoryItem;
}
impl NamedResource for InventoryReport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::InventoryReport;
}
impl NamedResource for Invoice {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Invoice;
}
impl NamedResource for Library {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Library;
}
impl NamedResource for Linkage {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Linkage;
}
impl NamedResource for List {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::List;
}
impl NamedResource for Location {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Location;
}
impl NamedResource for ManufacturedItemDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ManufacturedItemDefinition;
}
impl NamedResource for Measure {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Measure;
}
impl NamedResource for MeasureReport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MeasureReport;
}
impl NamedResource for Medication {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Medication;
}
impl NamedResource for MedicationAdministration {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicationAdministration;
}
impl NamedResource for MedicationDispense {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicationDispense;
}
impl NamedResource for MedicationKnowledge {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicationKnowledge;
}
impl NamedResource for MedicationRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicationRequest;
}
impl NamedResource for MedicationStatement {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicationStatement;
}
impl NamedResource for MedicinalProductDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MedicinalProductDefinition;
}
impl NamedResource for MessageDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MessageDefinition;
}
impl NamedResource for MessageHeader {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MessageHeader;
}
impl NamedResource for MolecularSequence {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::MolecularSequence;
}
impl NamedResource for NamingSystem {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::NamingSystem;
}
impl NamedResource for NutritionIntake {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::NutritionIntake;
}
impl NamedResource for NutritionOrder {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::NutritionOrder;
}
impl NamedResource for NutritionProduct {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::NutritionProduct;
}
impl NamedResource for Observation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Observation;
}
impl NamedResource for ObservationDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ObservationDefinition;
}
impl NamedResource for OperationDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::OperationDefinition;
}
impl NamedResource for OperationOutcome {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::OperationOutcome;
}
impl NamedResource for Organization {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Organization;
}
impl NamedResource for OrganizationAffiliation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::OrganizationAffiliation;
}
impl NamedResource for PackagedProductDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::PackagedProductDefinition;
}
impl NamedResource for Parameters {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Parameters;
}
impl NamedResource for Patient {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Patient;
}
impl NamedResource for PaymentNotice {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::PaymentNotice;
}
impl NamedResource for PaymentReconciliation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::PaymentReconciliation;
}
impl NamedResource for Permission {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Permission;
}
impl NamedResource for Person {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Person;
}
impl NamedResource for PlanDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::PlanDefinition;
}
impl NamedResource for Practitioner {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Practitioner;
}
impl NamedResource for PractitionerRole {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::PractitionerRole;
}
impl NamedResource for Procedure {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Procedure;
}
impl NamedResource for Provenance {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Provenance;
}
impl NamedResource for Questionnaire {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Questionnaire;
}
impl NamedResource for QuestionnaireResponse {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::QuestionnaireResponse;
}
impl NamedResource for RegulatedAuthorization {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::RegulatedAuthorization;
}
impl NamedResource for RelatedPerson {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::RelatedPerson;
}
impl NamedResource for RequestOrchestration {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::RequestOrchestration;
}
impl NamedResource for Requirements {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Requirements;
}
impl NamedResource for ResearchStudy {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ResearchStudy;
}
impl NamedResource for ResearchSubject {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ResearchSubject;
}
impl NamedResource for RiskAssessment {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::RiskAssessment;
}
impl NamedResource for Schedule {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Schedule;
}
impl NamedResource for SearchParameter {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SearchParameter;
}
impl NamedResource for ServiceRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ServiceRequest;
}
impl NamedResource for Slot {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Slot;
}
impl NamedResource for Specimen {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Specimen;
}
impl NamedResource for SpecimenDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SpecimenDefinition;
}
impl NamedResource for StructureDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::StructureDefinition;
}
impl NamedResource for StructureMap {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::StructureMap;
}
impl NamedResource for Subscription {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Subscription;
}
impl NamedResource for SubscriptionStatus {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubscriptionStatus;
}
impl NamedResource for SubscriptionTopic {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubscriptionTopic;
}
impl NamedResource for Substance {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Substance;
}
impl NamedResource for SubstanceDefinition {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstanceDefinition;
}
impl NamedResource for SubstanceNucleicAcid {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstanceNucleicAcid;
}
impl NamedResource for SubstancePolymer {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstancePolymer;
}
impl NamedResource for SubstanceProtein {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstanceProtein;
}
impl NamedResource for SubstanceReferenceInformation {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstanceReferenceInformation;
}
impl NamedResource for SubstanceSourceMaterial {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SubstanceSourceMaterial;
}
impl NamedResource for SupplyDelivery {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SupplyDelivery;
}
impl NamedResource for SupplyRequest {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::SupplyRequest;
}
impl NamedResource for Task {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Task;
}
impl NamedResource for TerminologyCapabilities {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::TerminologyCapabilities;
}
impl NamedResource for TestPlan {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::TestPlan;
}
impl NamedResource for TestReport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::TestReport;
}
impl NamedResource for TestScript {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::TestScript;
}
impl NamedResource for Transport {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::Transport;
}
impl NamedResource for ValueSet {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::ValueSet;
}
impl NamedResource for VerificationResult {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::VerificationResult;
}
impl NamedResource for VisionPrescription {
    const FHIR_VERSION: &'static str = "5.0.0";
    const TYPE: ResourceType = ResourceType::VisionPrescription;
}
