# WARNING: This file is autogenerated by FHIR Schema Codegen.
# https://github.com/fhir-schema/fhir-schema-codegen
# Any manual changes made to this file may be overwritten.

from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field, PositiveInt
from typing import List as PyList, Literal


class Element(BaseModel):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    extension: PyList[Extension] | None = Field(
        None, alias="extension", serialization_alias="extension"
    )
    id: str | None = Field(None, alias="id", serialization_alias="id")


class Quantity(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code: str | None = Field(None, alias="code", serialization_alias="code")
    comparator: Literal["<", "<=", ">=", ">"] | None = Field(
        None, alias="comparator", serialization_alias="comparator"
    )
    system: str | None = Field(None, alias="system", serialization_alias="system")
    unit: str | None = Field(None, alias="unit", serialization_alias="unit")
    value: float | None = Field(None, alias="value", serialization_alias="value")


class Age(Quantity):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    pass


class BackboneElement(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    modifier_extension: PyList[Extension] | None = Field(
        None, alias="modifierExtension", serialization_alias="modifierExtension"
    )


class ProductShelfLife(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    identifier: Identifier | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    period: Quantity = Field(alias="period", serialization_alias="period")
    special_precautions_for_storage: PyList[CodeableConcept] | None = Field(
        None,
        alias="specialPrecautionsForStorage",
        serialization_alias="specialPrecautionsForStorage",
    )
    type: CodeableConcept = Field(alias="type", serialization_alias="type")


class Duration(Quantity):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    pass


class DosageDoseAndRate(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    dose_quantity: Quantity | None = Field(
        None, alias="doseQuantity", serialization_alias="doseQuantity"
    )
    dose_range: Range | None = Field(
        None, alias="doseRange", serialization_alias="doseRange"
    )
    rate_quantity: Quantity | None = Field(
        None, alias="rateQuantity", serialization_alias="rateQuantity"
    )
    rate_range: Range | None = Field(
        None, alias="rateRange", serialization_alias="rateRange"
    )
    rate_ratio: Ratio | None = Field(
        None, alias="rateRatio", serialization_alias="rateRatio"
    )
    type: CodeableConcept | None = Field(None, alias="type", serialization_alias="type")


class Dosage(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    additional_instruction: PyList[CodeableConcept] | None = Field(
        None, alias="additionalInstruction", serialization_alias="additionalInstruction"
    )
    as_needed_boolean: bool | None = Field(
        None, alias="asNeededBoolean", serialization_alias="asNeededBoolean"
    )
    as_needed_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="asNeededCodeableConcept",
        serialization_alias="asNeededCodeableConcept",
    )
    dose_and_rate: PyList[DosageDoseAndRate] | None = Field(
        None, alias="doseAndRate", serialization_alias="doseAndRate"
    )
    max_dose_per_administration: Quantity | None = Field(
        None,
        alias="maxDosePerAdministration",
        serialization_alias="maxDosePerAdministration",
    )
    max_dose_per_lifetime: Quantity | None = Field(
        None, alias="maxDosePerLifetime", serialization_alias="maxDosePerLifetime"
    )
    max_dose_per_period: Ratio | None = Field(
        None, alias="maxDosePerPeriod", serialization_alias="maxDosePerPeriod"
    )
    method: CodeableConcept | None = Field(
        None, alias="method", serialization_alias="method"
    )
    patient_instruction: str | None = Field(
        None, alias="patientInstruction", serialization_alias="patientInstruction"
    )
    route: CodeableConcept | None = Field(
        None, alias="route", serialization_alias="route"
    )
    sequence: int | None = Field(None, alias="sequence", serialization_alias="sequence")
    site: CodeableConcept | None = Field(None, alias="site", serialization_alias="site")
    text: str | None = Field(None, alias="text", serialization_alias="text")
    timing: Timing | None = Field(None, alias="timing", serialization_alias="timing")


class Population(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    age_codeable_concept: CodeableConcept | None = Field(
        None, alias="ageCodeableConcept", serialization_alias="ageCodeableConcept"
    )
    age_range: Range | None = Field(
        None, alias="ageRange", serialization_alias="ageRange"
    )
    gender: CodeableConcept | None = Field(
        None, alias="gender", serialization_alias="gender"
    )
    physiological_condition: CodeableConcept | None = Field(
        None,
        alias="physiologicalCondition",
        serialization_alias="physiologicalCondition",
    )
    race: CodeableConcept | None = Field(None, alias="race", serialization_alias="race")


class SampledData(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    data: str | None = Field(None, alias="data", serialization_alias="data")
    dimensions: PositiveInt = Field(
        alias="dimensions", serialization_alias="dimensions"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    lower_limit: float | None = Field(
        None, alias="lowerLimit", serialization_alias="lowerLimit"
    )
    origin: Quantity = Field(alias="origin", serialization_alias="origin")
    period: float = Field(alias="period", serialization_alias="period")
    upper_limit: float | None = Field(
        None, alias="upperLimit", serialization_alias="upperLimit"
    )


class ProdCharacteristic(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    color: PyList[str] | None = Field(None, alias="color", serialization_alias="color")
    depth: Quantity | None = Field(None, alias="depth", serialization_alias="depth")
    external_diameter: Quantity | None = Field(
        None, alias="externalDiameter", serialization_alias="externalDiameter"
    )
    height: Quantity | None = Field(None, alias="height", serialization_alias="height")
    image: PyList[Attachment] | None = Field(
        None, alias="image", serialization_alias="image"
    )
    imprint: PyList[str] | None = Field(
        None, alias="imprint", serialization_alias="imprint"
    )
    nominal_volume: Quantity | None = Field(
        None, alias="nominalVolume", serialization_alias="nominalVolume"
    )
    scoring: CodeableConcept | None = Field(
        None, alias="scoring", serialization_alias="scoring"
    )
    shape: str | None = Field(None, alias="shape", serialization_alias="shape")
    weight: Quantity | None = Field(None, alias="weight", serialization_alias="weight")
    width: Quantity | None = Field(None, alias="width", serialization_alias="width")


class Extension(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    url: str = Field(alias="url", serialization_alias="url")
    value_address: Address | None = Field(
        None, alias="valueAddress", serialization_alias="valueAddress"
    )
    value_age: Age | None = Field(
        None, alias="valueAge", serialization_alias="valueAge"
    )
    value_annotation: Annotation | None = Field(
        None, alias="valueAnnotation", serialization_alias="valueAnnotation"
    )
    value_attachment: Attachment | None = Field(
        None, alias="valueAttachment", serialization_alias="valueAttachment"
    )
    value_base64binary: str | None = Field(
        None, alias="valueBase64Binary", serialization_alias="valueBase64Binary"
    )
    value_boolean: bool | None = Field(
        None, alias="valueBoolean", serialization_alias="valueBoolean"
    )
    value_canonical: str | None = Field(
        None, alias="valueCanonical", serialization_alias="valueCanonical"
    )
    value_code: str | None = Field(
        None, alias="valueCode", serialization_alias="valueCode"
    )
    value_codeable_concept: CodeableConcept | None = Field(
        None, alias="valueCodeableConcept", serialization_alias="valueCodeableConcept"
    )
    value_coding: Coding | None = Field(
        None, alias="valueCoding", serialization_alias="valueCoding"
    )
    value_contact_detail: ContactDetail | None = Field(
        None, alias="valueContactDetail", serialization_alias="valueContactDetail"
    )
    value_contact_point: ContactPoint | None = Field(
        None, alias="valueContactPoint", serialization_alias="valueContactPoint"
    )
    value_contributor: Contributor | None = Field(
        None, alias="valueContributor", serialization_alias="valueContributor"
    )
    value_count: Count | None = Field(
        None, alias="valueCount", serialization_alias="valueCount"
    )
    value_data_requirement: DataRequirement | None = Field(
        None, alias="valueDataRequirement", serialization_alias="valueDataRequirement"
    )
    value_date: str | None = Field(
        None, alias="valueDate", serialization_alias="valueDate"
    )
    value_date_time: str | None = Field(
        None, alias="valueDateTime", serialization_alias="valueDateTime"
    )
    value_decimal: float | None = Field(
        None, alias="valueDecimal", serialization_alias="valueDecimal"
    )
    value_distance: Distance | None = Field(
        None, alias="valueDistance", serialization_alias="valueDistance"
    )
    value_dosage: Dosage | None = Field(
        None, alias="valueDosage", serialization_alias="valueDosage"
    )
    value_duration: Duration | None = Field(
        None, alias="valueDuration", serialization_alias="valueDuration"
    )
    value_expression: Expression | None = Field(
        None, alias="valueExpression", serialization_alias="valueExpression"
    )
    value_human_name: HumanName | None = Field(
        None, alias="valueHumanName", serialization_alias="valueHumanName"
    )
    value_id: str | None = Field(None, alias="valueId", serialization_alias="valueId")
    value_identifier: Identifier | None = Field(
        None, alias="valueIdentifier", serialization_alias="valueIdentifier"
    )
    value_instant: str | None = Field(
        None, alias="valueInstant", serialization_alias="valueInstant"
    )
    value_integer: int | None = Field(
        None, alias="valueInteger", serialization_alias="valueInteger"
    )
    value_markdown: str | None = Field(
        None, alias="valueMarkdown", serialization_alias="valueMarkdown"
    )
    value_meta: Meta | None = Field(
        None, alias="valueMeta", serialization_alias="valueMeta"
    )
    value_money: Money | None = Field(
        None, alias="valueMoney", serialization_alias="valueMoney"
    )
    value_oid: str | None = Field(
        None, alias="valueOid", serialization_alias="valueOid"
    )
    value_parameter_definition: ParameterDefinition | None = Field(
        None,
        alias="valueParameterDefinition",
        serialization_alias="valueParameterDefinition",
    )
    value_period: Period | None = Field(
        None, alias="valuePeriod", serialization_alias="valuePeriod"
    )
    value_positive_int: PositiveInt | None = Field(
        None, alias="valuePositiveInt", serialization_alias="valuePositiveInt"
    )
    value_quantity: Quantity | None = Field(
        None, alias="valueQuantity", serialization_alias="valueQuantity"
    )
    value_range: Range | None = Field(
        None, alias="valueRange", serialization_alias="valueRange"
    )
    value_ratio: Ratio | None = Field(
        None, alias="valueRatio", serialization_alias="valueRatio"
    )
    value_reference: Reference | None = Field(
        None, alias="valueReference", serialization_alias="valueReference"
    )
    value_related_artifact: RelatedArtifact | None = Field(
        None, alias="valueRelatedArtifact", serialization_alias="valueRelatedArtifact"
    )
    value_sampled_data: SampledData | None = Field(
        None, alias="valueSampledData", serialization_alias="valueSampledData"
    )
    value_signature: Signature | None = Field(
        None, alias="valueSignature", serialization_alias="valueSignature"
    )
    value_string: str | None = Field(
        None, alias="valueString", serialization_alias="valueString"
    )
    value_time: str | None = Field(
        None, alias="valueTime", serialization_alias="valueTime"
    )
    value_timing: Timing | None = Field(
        None, alias="valueTiming", serialization_alias="valueTiming"
    )
    value_trigger_definition: TriggerDefinition | None = Field(
        None,
        alias="valueTriggerDefinition",
        serialization_alias="valueTriggerDefinition",
    )
    value_unsigned_int: int | None = Field(
        None, alias="valueUnsignedInt", serialization_alias="valueUnsignedInt"
    )
    value_uri: str | None = Field(
        None, alias="valueUri", serialization_alias="valueUri"
    )
    value_url: str | None = Field(
        None, alias="valueUrl", serialization_alias="valueUrl"
    )
    value_usage_context: UsageContext | None = Field(
        None, alias="valueUsageContext", serialization_alias="valueUsageContext"
    )
    value_uuid: str | None = Field(
        None, alias="valueUuid", serialization_alias="valueUuid"
    )


class Ratio(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    denominator: Quantity | None = Field(
        None, alias="denominator", serialization_alias="denominator"
    )
    numerator: Quantity | None = Field(
        None, alias="numerator", serialization_alias="numerator"
    )


class Count(Quantity):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    pass


class ParameterDefinition(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    documentation: str | None = Field(
        None, alias="documentation", serialization_alias="documentation"
    )
    max: str | None = Field(None, alias="max", serialization_alias="max")
    min: int | None = Field(None, alias="min", serialization_alias="min")
    name: str | None = Field(None, alias="name", serialization_alias="name")
    profile: str | None = Field(None, alias="profile", serialization_alias="profile")
    type: Literal[
        "Address",
        "Age",
        "Annotation",
        "Attachment",
        "BackboneElement",
        "CodeableConcept",
        "Coding",
        "ContactDetail",
        "ContactPoint",
        "Contributor",
        "Count",
        "DataRequirement",
        "Distance",
        "Dosage",
        "Duration",
        "Element",
        "ElementDefinition",
        "Expression",
        "Extension",
        "HumanName",
        "Identifier",
        "MarketingStatus",
        "Meta",
        "Money",
        "MoneyQuantity",
        "Narrative",
        "ParameterDefinition",
        "Period",
        "Population",
        "ProdCharacteristic",
        "ProductShelfLife",
        "Quantity",
        "Range",
        "Ratio",
        "Reference",
        "RelatedArtifact",
        "SampledData",
        "Signature",
        "SimpleQuantity",
        "SubstanceAmount",
        "Timing",
        "TriggerDefinition",
        "UsageContext",
        "base64Binary",
        "boolean",
        "canonical",
        "code",
        "date",
        "dateTime",
        "decimal",
        "id",
        "instant",
        "integer",
        "markdown",
        "oid",
        "positiveInt",
        "string",
        "time",
        "unsignedInt",
        "uri",
        "url",
        "uuid",
        "xhtml",
        "Account",
        "ActivityDefinition",
        "AdverseEvent",
        "AllergyIntolerance",
        "Appointment",
        "AppointmentResponse",
        "AuditEvent",
        "Basic",
        "Binary",
        "BiologicallyDerivedProduct",
        "BodyStructure",
        "Bundle",
        "CapabilityStatement",
        "CarePlan",
        "CareTeam",
        "CatalogEntry",
        "ChargeItem",
        "ChargeItemDefinition",
        "Claim",
        "ClaimResponse",
        "ClinicalImpression",
        "CodeSystem",
        "Communication",
        "CommunicationRequest",
        "CompartmentDefinition",
        "Composition",
        "ConceptMap",
        "Condition",
        "Consent",
        "Contract",
        "Coverage",
        "CoverageEligibilityRequest",
        "CoverageEligibilityResponse",
        "DetectedIssue",
        "Device",
        "DeviceDefinition",
        "DeviceMetric",
        "DeviceRequest",
        "DeviceUseStatement",
        "DiagnosticReport",
        "DocumentManifest",
        "DocumentReference",
        "DomainResource",
        "EffectEvidenceSynthesis",
        "Encounter",
        "Endpoint",
        "EnrollmentRequest",
        "EnrollmentResponse",
        "EpisodeOfCare",
        "EventDefinition",
        "Evidence",
        "EvidenceVariable",
        "ExampleScenario",
        "ExplanationOfBenefit",
        "FamilyMemberHistory",
        "Flag",
        "Goal",
        "GraphDefinition",
        "Group",
        "GuidanceResponse",
        "HealthcareService",
        "ImagingStudy",
        "Immunization",
        "ImmunizationEvaluation",
        "ImmunizationRecommendation",
        "ImplementationGuide",
        "InsurancePlan",
        "Invoice",
        "Library",
        "Linkage",
        "List",
        "Location",
        "Measure",
        "MeasureReport",
        "Media",
        "Medication",
        "MedicationAdministration",
        "MedicationDispense",
        "MedicationKnowledge",
        "MedicationRequest",
        "MedicationStatement",
        "MedicinalProduct",
        "MedicinalProductAuthorization",
        "MedicinalProductContraindication",
        "MedicinalProductIndication",
        "MedicinalProductIngredient",
        "MedicinalProductInteraction",
        "MedicinalProductManufactured",
        "MedicinalProductPackaged",
        "MedicinalProductPharmaceutical",
        "MedicinalProductUndesirableEffect",
        "MessageDefinition",
        "MessageHeader",
        "MolecularSequence",
        "NamingSystem",
        "NutritionOrder",
        "Observation",
        "ObservationDefinition",
        "OperationDefinition",
        "OperationOutcome",
        "Organization",
        "OrganizationAffiliation",
        "Parameters",
        "Patient",
        "PaymentNotice",
        "PaymentReconciliation",
        "Person",
        "PlanDefinition",
        "Practitioner",
        "PractitionerRole",
        "Procedure",
        "Provenance",
        "Questionnaire",
        "QuestionnaireResponse",
        "RelatedPerson",
        "RequestGroup",
        "ResearchDefinition",
        "ResearchElementDefinition",
        "ResearchStudy",
        "ResearchSubject",
        "Resource",
        "RiskAssessment",
        "RiskEvidenceSynthesis",
        "Schedule",
        "SearchParameter",
        "ServiceRequest",
        "Slot",
        "Specimen",
        "SpecimenDefinition",
        "StructureDefinition",
        "StructureMap",
        "Subscription",
        "Substance",
        "SubstanceNucleicAcid",
        "SubstancePolymer",
        "SubstanceProtein",
        "SubstanceReferenceInformation",
        "SubstanceSourceMaterial",
        "SubstanceSpecification",
        "SupplyDelivery",
        "SupplyRequest",
        "Task",
        "TerminologyCapabilities",
        "TestReport",
        "TestScript",
        "ValueSet",
        "VerificationResult",
        "VisionPrescription",
        "Type",
        "Any",
    ] = Field(alias="type", serialization_alias="type")
    use: Literal["in", "out"] = Field(alias="use", serialization_alias="use")


class ContactDetail(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    name: str | None = Field(None, alias="name", serialization_alias="name")
    telecom: PyList[ContactPoint] | None = Field(
        None, alias="telecom", serialization_alias="telecom"
    )


class Address(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    city: str | None = Field(None, alias="city", serialization_alias="city")
    country: str | None = Field(None, alias="country", serialization_alias="country")
    district: str | None = Field(None, alias="district", serialization_alias="district")
    line: PyList[str] | None = Field(None, alias="line", serialization_alias="line")
    period: Period | None = Field(None, alias="period", serialization_alias="period")
    postal_code: str | None = Field(
        None, alias="postalCode", serialization_alias="postalCode"
    )
    state: str | None = Field(None, alias="state", serialization_alias="state")
    text: str | None = Field(None, alias="text", serialization_alias="text")
    type: Literal["postal", "physical", "both"] | None = Field(
        None, alias="type", serialization_alias="type"
    )
    use: Literal["home", "work", "temp", "old", "billing"] | None = Field(
        None, alias="use", serialization_alias="use"
    )


class Coding(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code: str | None = Field(None, alias="code", serialization_alias="code")
    display: str | None = Field(None, alias="display", serialization_alias="display")
    system: str | None = Field(None, alias="system", serialization_alias="system")
    user_selected: bool | None = Field(
        None, alias="userSelected", serialization_alias="userSelected"
    )
    version: str | None = Field(None, alias="version", serialization_alias="version")


class Reference(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    display: str | None = Field(None, alias="display", serialization_alias="display")
    identifier: Identifier | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    reference: str | None = Field(
        None, alias="reference", serialization_alias="reference"
    )
    type: str | None = Field(None, alias="type", serialization_alias="type")


class ElementDefinitionBase(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    max: str = Field(alias="max", serialization_alias="max")
    min: int = Field(alias="min", serialization_alias="min")
    path: str = Field(alias="path", serialization_alias="path")


class ElementDefinitionBinding(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    description: str | None = Field(
        None, alias="description", serialization_alias="description"
    )
    strength: Literal["required", "extensible", "preferred", "example"] = Field(
        alias="strength", serialization_alias="strength"
    )
    value_set: str | None = Field(
        None, alias="valueSet", serialization_alias="valueSet"
    )


class ElementDefinitionConstraint(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    expression: str | None = Field(
        None, alias="expression", serialization_alias="expression"
    )
    human: str = Field(alias="human", serialization_alias="human")
    key: str = Field(alias="key", serialization_alias="key")
    requirements: str | None = Field(
        None, alias="requirements", serialization_alias="requirements"
    )
    severity: Literal["error", "warning"] = Field(
        alias="severity", serialization_alias="severity"
    )
    source: str | None = Field(None, alias="source", serialization_alias="source")
    xpath: str | None = Field(None, alias="xpath", serialization_alias="xpath")


class ElementDefinitionExample(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    label: str = Field(alias="label", serialization_alias="label")
    value_address: Address | None = Field(
        None, alias="valueAddress", serialization_alias="valueAddress"
    )
    value_age: Age | None = Field(
        None, alias="valueAge", serialization_alias="valueAge"
    )
    value_annotation: Annotation | None = Field(
        None, alias="valueAnnotation", serialization_alias="valueAnnotation"
    )
    value_attachment: Attachment | None = Field(
        None, alias="valueAttachment", serialization_alias="valueAttachment"
    )
    value_base64binary: str | None = Field(
        None, alias="valueBase64Binary", serialization_alias="valueBase64Binary"
    )
    value_boolean: bool | None = Field(
        None, alias="valueBoolean", serialization_alias="valueBoolean"
    )
    value_canonical: str | None = Field(
        None, alias="valueCanonical", serialization_alias="valueCanonical"
    )
    value_code: str | None = Field(
        None, alias="valueCode", serialization_alias="valueCode"
    )
    value_codeable_concept: CodeableConcept | None = Field(
        None, alias="valueCodeableConcept", serialization_alias="valueCodeableConcept"
    )
    value_coding: Coding | None = Field(
        None, alias="valueCoding", serialization_alias="valueCoding"
    )
    value_contact_detail: ContactDetail | None = Field(
        None, alias="valueContactDetail", serialization_alias="valueContactDetail"
    )
    value_contact_point: ContactPoint | None = Field(
        None, alias="valueContactPoint", serialization_alias="valueContactPoint"
    )
    value_contributor: Contributor | None = Field(
        None, alias="valueContributor", serialization_alias="valueContributor"
    )
    value_count: Count | None = Field(
        None, alias="valueCount", serialization_alias="valueCount"
    )
    value_data_requirement: DataRequirement | None = Field(
        None, alias="valueDataRequirement", serialization_alias="valueDataRequirement"
    )
    value_date: str | None = Field(
        None, alias="valueDate", serialization_alias="valueDate"
    )
    value_date_time: str | None = Field(
        None, alias="valueDateTime", serialization_alias="valueDateTime"
    )
    value_decimal: float | None = Field(
        None, alias="valueDecimal", serialization_alias="valueDecimal"
    )
    value_distance: Distance | None = Field(
        None, alias="valueDistance", serialization_alias="valueDistance"
    )
    value_dosage: Dosage | None = Field(
        None, alias="valueDosage", serialization_alias="valueDosage"
    )
    value_duration: Duration | None = Field(
        None, alias="valueDuration", serialization_alias="valueDuration"
    )
    value_expression: Expression | None = Field(
        None, alias="valueExpression", serialization_alias="valueExpression"
    )
    value_human_name: HumanName | None = Field(
        None, alias="valueHumanName", serialization_alias="valueHumanName"
    )
    value_id: str | None = Field(None, alias="valueId", serialization_alias="valueId")
    value_identifier: Identifier | None = Field(
        None, alias="valueIdentifier", serialization_alias="valueIdentifier"
    )
    value_instant: str | None = Field(
        None, alias="valueInstant", serialization_alias="valueInstant"
    )
    value_integer: int | None = Field(
        None, alias="valueInteger", serialization_alias="valueInteger"
    )
    value_markdown: str | None = Field(
        None, alias="valueMarkdown", serialization_alias="valueMarkdown"
    )
    value_meta: Meta | None = Field(
        None, alias="valueMeta", serialization_alias="valueMeta"
    )
    value_money: Money | None = Field(
        None, alias="valueMoney", serialization_alias="valueMoney"
    )
    value_oid: str | None = Field(
        None, alias="valueOid", serialization_alias="valueOid"
    )
    value_parameter_definition: ParameterDefinition | None = Field(
        None,
        alias="valueParameterDefinition",
        serialization_alias="valueParameterDefinition",
    )
    value_period: Period | None = Field(
        None, alias="valuePeriod", serialization_alias="valuePeriod"
    )
    value_positive_int: PositiveInt | None = Field(
        None, alias="valuePositiveInt", serialization_alias="valuePositiveInt"
    )
    value_quantity: Quantity | None = Field(
        None, alias="valueQuantity", serialization_alias="valueQuantity"
    )
    value_range: Range | None = Field(
        None, alias="valueRange", serialization_alias="valueRange"
    )
    value_ratio: Ratio | None = Field(
        None, alias="valueRatio", serialization_alias="valueRatio"
    )
    value_reference: Reference | None = Field(
        None, alias="valueReference", serialization_alias="valueReference"
    )
    value_related_artifact: RelatedArtifact | None = Field(
        None, alias="valueRelatedArtifact", serialization_alias="valueRelatedArtifact"
    )
    value_sampled_data: SampledData | None = Field(
        None, alias="valueSampledData", serialization_alias="valueSampledData"
    )
    value_signature: Signature | None = Field(
        None, alias="valueSignature", serialization_alias="valueSignature"
    )
    value_string: str | None = Field(
        None, alias="valueString", serialization_alias="valueString"
    )
    value_time: str | None = Field(
        None, alias="valueTime", serialization_alias="valueTime"
    )
    value_timing: Timing | None = Field(
        None, alias="valueTiming", serialization_alias="valueTiming"
    )
    value_trigger_definition: TriggerDefinition | None = Field(
        None,
        alias="valueTriggerDefinition",
        serialization_alias="valueTriggerDefinition",
    )
    value_unsigned_int: int | None = Field(
        None, alias="valueUnsignedInt", serialization_alias="valueUnsignedInt"
    )
    value_uri: str | None = Field(
        None, alias="valueUri", serialization_alias="valueUri"
    )
    value_url: str | None = Field(
        None, alias="valueUrl", serialization_alias="valueUrl"
    )
    value_usage_context: UsageContext | None = Field(
        None, alias="valueUsageContext", serialization_alias="valueUsageContext"
    )
    value_uuid: str | None = Field(
        None, alias="valueUuid", serialization_alias="valueUuid"
    )


class ElementDefinitionMapping(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    comment: str | None = Field(None, alias="comment", serialization_alias="comment")
    identity: str = Field(alias="identity", serialization_alias="identity")
    language: str | None = Field(None, alias="language", serialization_alias="language")
    map: str = Field(alias="map", serialization_alias="map")


class ElementDefinitionSlicing(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    description: str | None = Field(
        None, alias="description", serialization_alias="description"
    )
    discriminator: PyList[ElementDefinitionSlicingDiscriminator] | None = Field(
        None, alias="discriminator", serialization_alias="discriminator"
    )
    ordered: bool | None = Field(None, alias="ordered", serialization_alias="ordered")
    rules: Literal["closed", "open", "openAtEnd"] = Field(
        alias="rules", serialization_alias="rules"
    )


class ElementDefinitionSlicingDiscriminator(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    path: str = Field(alias="path", serialization_alias="path")
    type: Literal["value", "exists", "pattern", "type", "profile"] = Field(
        alias="type", serialization_alias="type"
    )


class ElementDefinitionType(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    aggregation: PyList[Literal["contained", "referenced", "bundled"]] | None = Field(
        None, alias="aggregation", serialization_alias="aggregation"
    )
    code: str = Field(alias="code", serialization_alias="code")
    profile: PyList[str] | None = Field(
        None, alias="profile", serialization_alias="profile"
    )
    target_profile: PyList[str] | None = Field(
        None, alias="targetProfile", serialization_alias="targetProfile"
    )
    versioning: Literal["either", "independent", "specific"] | None = Field(
        None, alias="versioning", serialization_alias="versioning"
    )


class ElementDefinition(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    alias: PyList[str] | None = Field(None, alias="alias", serialization_alias="alias")
    base: ElementDefinitionBase | None = Field(
        None, alias="base", serialization_alias="base"
    )
    binding: ElementDefinitionBinding | None = Field(
        None, alias="binding", serialization_alias="binding"
    )
    code: PyList[Coding] | None = Field(None, alias="code", serialization_alias="code")
    comment: str | None = Field(None, alias="comment", serialization_alias="comment")
    condition: PyList[str] | None = Field(
        None, alias="condition", serialization_alias="condition"
    )
    constraint: PyList[ElementDefinitionConstraint] | None = Field(
        None, alias="constraint", serialization_alias="constraint"
    )
    content_reference: str | None = Field(
        None, alias="contentReference", serialization_alias="contentReference"
    )
    default_value_address: Address | None = Field(
        None, alias="defaultValueAddress", serialization_alias="defaultValueAddress"
    )
    default_value_age: Age | None = Field(
        None, alias="defaultValueAge", serialization_alias="defaultValueAge"
    )
    default_value_annotation: Annotation | None = Field(
        None,
        alias="defaultValueAnnotation",
        serialization_alias="defaultValueAnnotation",
    )
    default_value_attachment: Attachment | None = Field(
        None,
        alias="defaultValueAttachment",
        serialization_alias="defaultValueAttachment",
    )
    default_value_base64binary: str | None = Field(
        None,
        alias="defaultValueBase64Binary",
        serialization_alias="defaultValueBase64Binary",
    )
    default_value_boolean: bool | None = Field(
        None, alias="defaultValueBoolean", serialization_alias="defaultValueBoolean"
    )
    default_value_canonical: str | None = Field(
        None, alias="defaultValueCanonical", serialization_alias="defaultValueCanonical"
    )
    default_value_code: str | None = Field(
        None, alias="defaultValueCode", serialization_alias="defaultValueCode"
    )
    default_value_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="defaultValueCodeableConcept",
        serialization_alias="defaultValueCodeableConcept",
    )
    default_value_coding: Coding | None = Field(
        None, alias="defaultValueCoding", serialization_alias="defaultValueCoding"
    )
    default_value_contact_detail: ContactDetail | None = Field(
        None,
        alias="defaultValueContactDetail",
        serialization_alias="defaultValueContactDetail",
    )
    default_value_contact_point: ContactPoint | None = Field(
        None,
        alias="defaultValueContactPoint",
        serialization_alias="defaultValueContactPoint",
    )
    default_value_contributor: Contributor | None = Field(
        None,
        alias="defaultValueContributor",
        serialization_alias="defaultValueContributor",
    )
    default_value_count: Count | None = Field(
        None, alias="defaultValueCount", serialization_alias="defaultValueCount"
    )
    default_value_data_requirement: DataRequirement | None = Field(
        None,
        alias="defaultValueDataRequirement",
        serialization_alias="defaultValueDataRequirement",
    )
    default_value_date: str | None = Field(
        None, alias="defaultValueDate", serialization_alias="defaultValueDate"
    )
    default_value_date_time: str | None = Field(
        None, alias="defaultValueDateTime", serialization_alias="defaultValueDateTime"
    )
    default_value_decimal: float | None = Field(
        None, alias="defaultValueDecimal", serialization_alias="defaultValueDecimal"
    )
    default_value_distance: Distance | None = Field(
        None, alias="defaultValueDistance", serialization_alias="defaultValueDistance"
    )
    default_value_dosage: Dosage | None = Field(
        None, alias="defaultValueDosage", serialization_alias="defaultValueDosage"
    )
    default_value_duration: Duration | None = Field(
        None, alias="defaultValueDuration", serialization_alias="defaultValueDuration"
    )
    default_value_expression: Expression | None = Field(
        None,
        alias="defaultValueExpression",
        serialization_alias="defaultValueExpression",
    )
    default_value_human_name: HumanName | None = Field(
        None, alias="defaultValueHumanName", serialization_alias="defaultValueHumanName"
    )
    default_value_id: str | None = Field(
        None, alias="defaultValueId", serialization_alias="defaultValueId"
    )
    default_value_identifier: Identifier | None = Field(
        None,
        alias="defaultValueIdentifier",
        serialization_alias="defaultValueIdentifier",
    )
    default_value_instant: str | None = Field(
        None, alias="defaultValueInstant", serialization_alias="defaultValueInstant"
    )
    default_value_integer: int | None = Field(
        None, alias="defaultValueInteger", serialization_alias="defaultValueInteger"
    )
    default_value_markdown: str | None = Field(
        None, alias="defaultValueMarkdown", serialization_alias="defaultValueMarkdown"
    )
    default_value_meta: Meta | None = Field(
        None, alias="defaultValueMeta", serialization_alias="defaultValueMeta"
    )
    default_value_money: Money | None = Field(
        None, alias="defaultValueMoney", serialization_alias="defaultValueMoney"
    )
    default_value_oid: str | None = Field(
        None, alias="defaultValueOid", serialization_alias="defaultValueOid"
    )
    default_value_parameter_definition: ParameterDefinition | None = Field(
        None,
        alias="defaultValueParameterDefinition",
        serialization_alias="defaultValueParameterDefinition",
    )
    default_value_period: Period | None = Field(
        None, alias="defaultValuePeriod", serialization_alias="defaultValuePeriod"
    )
    default_value_positive_int: PositiveInt | None = Field(
        None,
        alias="defaultValuePositiveInt",
        serialization_alias="defaultValuePositiveInt",
    )
    default_value_quantity: Quantity | None = Field(
        None, alias="defaultValueQuantity", serialization_alias="defaultValueQuantity"
    )
    default_value_range: Range | None = Field(
        None, alias="defaultValueRange", serialization_alias="defaultValueRange"
    )
    default_value_ratio: Ratio | None = Field(
        None, alias="defaultValueRatio", serialization_alias="defaultValueRatio"
    )
    default_value_reference: Reference | None = Field(
        None, alias="defaultValueReference", serialization_alias="defaultValueReference"
    )
    default_value_related_artifact: RelatedArtifact | None = Field(
        None,
        alias="defaultValueRelatedArtifact",
        serialization_alias="defaultValueRelatedArtifact",
    )
    default_value_sampled_data: SampledData | None = Field(
        None,
        alias="defaultValueSampledData",
        serialization_alias="defaultValueSampledData",
    )
    default_value_signature: Signature | None = Field(
        None, alias="defaultValueSignature", serialization_alias="defaultValueSignature"
    )
    default_value_string: str | None = Field(
        None, alias="defaultValueString", serialization_alias="defaultValueString"
    )
    default_value_time: str | None = Field(
        None, alias="defaultValueTime", serialization_alias="defaultValueTime"
    )
    default_value_timing: Timing | None = Field(
        None, alias="defaultValueTiming", serialization_alias="defaultValueTiming"
    )
    default_value_trigger_definition: TriggerDefinition | None = Field(
        None,
        alias="defaultValueTriggerDefinition",
        serialization_alias="defaultValueTriggerDefinition",
    )
    default_value_unsigned_int: int | None = Field(
        None,
        alias="defaultValueUnsignedInt",
        serialization_alias="defaultValueUnsignedInt",
    )
    default_value_uri: str | None = Field(
        None, alias="defaultValueUri", serialization_alias="defaultValueUri"
    )
    default_value_url: str | None = Field(
        None, alias="defaultValueUrl", serialization_alias="defaultValueUrl"
    )
    default_value_usage_context: UsageContext | None = Field(
        None,
        alias="defaultValueUsageContext",
        serialization_alias="defaultValueUsageContext",
    )
    default_value_uuid: str | None = Field(
        None, alias="defaultValueUuid", serialization_alias="defaultValueUuid"
    )
    definition: str | None = Field(
        None, alias="definition", serialization_alias="definition"
    )
    example: PyList[ElementDefinitionExample] | None = Field(
        None, alias="example", serialization_alias="example"
    )
    fixed_address: Address | None = Field(
        None, alias="fixedAddress", serialization_alias="fixedAddress"
    )
    fixed_age: Age | None = Field(
        None, alias="fixedAge", serialization_alias="fixedAge"
    )
    fixed_annotation: Annotation | None = Field(
        None, alias="fixedAnnotation", serialization_alias="fixedAnnotation"
    )
    fixed_attachment: Attachment | None = Field(
        None, alias="fixedAttachment", serialization_alias="fixedAttachment"
    )
    fixed_base64binary: str | None = Field(
        None, alias="fixedBase64Binary", serialization_alias="fixedBase64Binary"
    )
    fixed_boolean: bool | None = Field(
        None, alias="fixedBoolean", serialization_alias="fixedBoolean"
    )
    fixed_canonical: str | None = Field(
        None, alias="fixedCanonical", serialization_alias="fixedCanonical"
    )
    fixed_code: str | None = Field(
        None, alias="fixedCode", serialization_alias="fixedCode"
    )
    fixed_codeable_concept: CodeableConcept | None = Field(
        None, alias="fixedCodeableConcept", serialization_alias="fixedCodeableConcept"
    )
    fixed_coding: Coding | None = Field(
        None, alias="fixedCoding", serialization_alias="fixedCoding"
    )
    fixed_contact_detail: ContactDetail | None = Field(
        None, alias="fixedContactDetail", serialization_alias="fixedContactDetail"
    )
    fixed_contact_point: ContactPoint | None = Field(
        None, alias="fixedContactPoint", serialization_alias="fixedContactPoint"
    )
    fixed_contributor: Contributor | None = Field(
        None, alias="fixedContributor", serialization_alias="fixedContributor"
    )
    fixed_count: Count | None = Field(
        None, alias="fixedCount", serialization_alias="fixedCount"
    )
    fixed_data_requirement: DataRequirement | None = Field(
        None, alias="fixedDataRequirement", serialization_alias="fixedDataRequirement"
    )
    fixed_date: str | None = Field(
        None, alias="fixedDate", serialization_alias="fixedDate"
    )
    fixed_date_time: str | None = Field(
        None, alias="fixedDateTime", serialization_alias="fixedDateTime"
    )
    fixed_decimal: float | None = Field(
        None, alias="fixedDecimal", serialization_alias="fixedDecimal"
    )
    fixed_distance: Distance | None = Field(
        None, alias="fixedDistance", serialization_alias="fixedDistance"
    )
    fixed_dosage: Dosage | None = Field(
        None, alias="fixedDosage", serialization_alias="fixedDosage"
    )
    fixed_duration: Duration | None = Field(
        None, alias="fixedDuration", serialization_alias="fixedDuration"
    )
    fixed_expression: Expression | None = Field(
        None, alias="fixedExpression", serialization_alias="fixedExpression"
    )
    fixed_human_name: HumanName | None = Field(
        None, alias="fixedHumanName", serialization_alias="fixedHumanName"
    )
    fixed_id: str | None = Field(None, alias="fixedId", serialization_alias="fixedId")
    fixed_identifier: Identifier | None = Field(
        None, alias="fixedIdentifier", serialization_alias="fixedIdentifier"
    )
    fixed_instant: str | None = Field(
        None, alias="fixedInstant", serialization_alias="fixedInstant"
    )
    fixed_integer: int | None = Field(
        None, alias="fixedInteger", serialization_alias="fixedInteger"
    )
    fixed_markdown: str | None = Field(
        None, alias="fixedMarkdown", serialization_alias="fixedMarkdown"
    )
    fixed_meta: Meta | None = Field(
        None, alias="fixedMeta", serialization_alias="fixedMeta"
    )
    fixed_money: Money | None = Field(
        None, alias="fixedMoney", serialization_alias="fixedMoney"
    )
    fixed_oid: str | None = Field(
        None, alias="fixedOid", serialization_alias="fixedOid"
    )
    fixed_parameter_definition: ParameterDefinition | None = Field(
        None,
        alias="fixedParameterDefinition",
        serialization_alias="fixedParameterDefinition",
    )
    fixed_period: Period | None = Field(
        None, alias="fixedPeriod", serialization_alias="fixedPeriod"
    )
    fixed_positive_int: PositiveInt | None = Field(
        None, alias="fixedPositiveInt", serialization_alias="fixedPositiveInt"
    )
    fixed_quantity: Quantity | None = Field(
        None, alias="fixedQuantity", serialization_alias="fixedQuantity"
    )
    fixed_range: Range | None = Field(
        None, alias="fixedRange", serialization_alias="fixedRange"
    )
    fixed_ratio: Ratio | None = Field(
        None, alias="fixedRatio", serialization_alias="fixedRatio"
    )
    fixed_reference: Reference | None = Field(
        None, alias="fixedReference", serialization_alias="fixedReference"
    )
    fixed_related_artifact: RelatedArtifact | None = Field(
        None, alias="fixedRelatedArtifact", serialization_alias="fixedRelatedArtifact"
    )
    fixed_sampled_data: SampledData | None = Field(
        None, alias="fixedSampledData", serialization_alias="fixedSampledData"
    )
    fixed_signature: Signature | None = Field(
        None, alias="fixedSignature", serialization_alias="fixedSignature"
    )
    fixed_string: str | None = Field(
        None, alias="fixedString", serialization_alias="fixedString"
    )
    fixed_time: str | None = Field(
        None, alias="fixedTime", serialization_alias="fixedTime"
    )
    fixed_timing: Timing | None = Field(
        None, alias="fixedTiming", serialization_alias="fixedTiming"
    )
    fixed_trigger_definition: TriggerDefinition | None = Field(
        None,
        alias="fixedTriggerDefinition",
        serialization_alias="fixedTriggerDefinition",
    )
    fixed_unsigned_int: int | None = Field(
        None, alias="fixedUnsignedInt", serialization_alias="fixedUnsignedInt"
    )
    fixed_uri: str | None = Field(
        None, alias="fixedUri", serialization_alias="fixedUri"
    )
    fixed_url: str | None = Field(
        None, alias="fixedUrl", serialization_alias="fixedUrl"
    )
    fixed_usage_context: UsageContext | None = Field(
        None, alias="fixedUsageContext", serialization_alias="fixedUsageContext"
    )
    fixed_uuid: str | None = Field(
        None, alias="fixedUuid", serialization_alias="fixedUuid"
    )
    is_modifier: bool | None = Field(
        None, alias="isModifier", serialization_alias="isModifier"
    )
    is_modifier_reason: str | None = Field(
        None, alias="isModifierReason", serialization_alias="isModifierReason"
    )
    is_summary: bool | None = Field(
        None, alias="isSummary", serialization_alias="isSummary"
    )
    label: str | None = Field(None, alias="label", serialization_alias="label")
    mapping: PyList[ElementDefinitionMapping] | None = Field(
        None, alias="mapping", serialization_alias="mapping"
    )
    max: str | None = Field(None, alias="max", serialization_alias="max")
    max_length: int | None = Field(
        None, alias="maxLength", serialization_alias="maxLength"
    )
    max_value_date: str | None = Field(
        None, alias="maxValueDate", serialization_alias="maxValueDate"
    )
    max_value_date_time: str | None = Field(
        None, alias="maxValueDateTime", serialization_alias="maxValueDateTime"
    )
    max_value_decimal: float | None = Field(
        None, alias="maxValueDecimal", serialization_alias="maxValueDecimal"
    )
    max_value_instant: str | None = Field(
        None, alias="maxValueInstant", serialization_alias="maxValueInstant"
    )
    max_value_integer: int | None = Field(
        None, alias="maxValueInteger", serialization_alias="maxValueInteger"
    )
    max_value_positive_int: PositiveInt | None = Field(
        None, alias="maxValuePositiveInt", serialization_alias="maxValuePositiveInt"
    )
    max_value_quantity: Quantity | None = Field(
        None, alias="maxValueQuantity", serialization_alias="maxValueQuantity"
    )
    max_value_time: str | None = Field(
        None, alias="maxValueTime", serialization_alias="maxValueTime"
    )
    max_value_unsigned_int: int | None = Field(
        None, alias="maxValueUnsignedInt", serialization_alias="maxValueUnsignedInt"
    )
    meaning_when_missing: str | None = Field(
        None, alias="meaningWhenMissing", serialization_alias="meaningWhenMissing"
    )
    min: int | None = Field(None, alias="min", serialization_alias="min")
    min_value_date: str | None = Field(
        None, alias="minValueDate", serialization_alias="minValueDate"
    )
    min_value_date_time: str | None = Field(
        None, alias="minValueDateTime", serialization_alias="minValueDateTime"
    )
    min_value_decimal: float | None = Field(
        None, alias="minValueDecimal", serialization_alias="minValueDecimal"
    )
    min_value_instant: str | None = Field(
        None, alias="minValueInstant", serialization_alias="minValueInstant"
    )
    min_value_integer: int | None = Field(
        None, alias="minValueInteger", serialization_alias="minValueInteger"
    )
    min_value_positive_int: PositiveInt | None = Field(
        None, alias="minValuePositiveInt", serialization_alias="minValuePositiveInt"
    )
    min_value_quantity: Quantity | None = Field(
        None, alias="minValueQuantity", serialization_alias="minValueQuantity"
    )
    min_value_time: str | None = Field(
        None, alias="minValueTime", serialization_alias="minValueTime"
    )
    min_value_unsigned_int: int | None = Field(
        None, alias="minValueUnsignedInt", serialization_alias="minValueUnsignedInt"
    )
    must_support: bool | None = Field(
        None, alias="mustSupport", serialization_alias="mustSupport"
    )
    order_meaning: str | None = Field(
        None, alias="orderMeaning", serialization_alias="orderMeaning"
    )
    path: str = Field(alias="path", serialization_alias="path")
    pattern_address: Address | None = Field(
        None, alias="patternAddress", serialization_alias="patternAddress"
    )
    pattern_age: Age | None = Field(
        None, alias="patternAge", serialization_alias="patternAge"
    )
    pattern_annotation: Annotation | None = Field(
        None, alias="patternAnnotation", serialization_alias="patternAnnotation"
    )
    pattern_attachment: Attachment | None = Field(
        None, alias="patternAttachment", serialization_alias="patternAttachment"
    )
    pattern_base64binary: str | None = Field(
        None, alias="patternBase64Binary", serialization_alias="patternBase64Binary"
    )
    pattern_boolean: bool | None = Field(
        None, alias="patternBoolean", serialization_alias="patternBoolean"
    )
    pattern_canonical: str | None = Field(
        None, alias="patternCanonical", serialization_alias="patternCanonical"
    )
    pattern_code: str | None = Field(
        None, alias="patternCode", serialization_alias="patternCode"
    )
    pattern_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="patternCodeableConcept",
        serialization_alias="patternCodeableConcept",
    )
    pattern_coding: Coding | None = Field(
        None, alias="patternCoding", serialization_alias="patternCoding"
    )
    pattern_contact_detail: ContactDetail | None = Field(
        None, alias="patternContactDetail", serialization_alias="patternContactDetail"
    )
    pattern_contact_point: ContactPoint | None = Field(
        None, alias="patternContactPoint", serialization_alias="patternContactPoint"
    )
    pattern_contributor: Contributor | None = Field(
        None, alias="patternContributor", serialization_alias="patternContributor"
    )
    pattern_count: Count | None = Field(
        None, alias="patternCount", serialization_alias="patternCount"
    )
    pattern_data_requirement: DataRequirement | None = Field(
        None,
        alias="patternDataRequirement",
        serialization_alias="patternDataRequirement",
    )
    pattern_date: str | None = Field(
        None, alias="patternDate", serialization_alias="patternDate"
    )
    pattern_date_time: str | None = Field(
        None, alias="patternDateTime", serialization_alias="patternDateTime"
    )
    pattern_decimal: float | None = Field(
        None, alias="patternDecimal", serialization_alias="patternDecimal"
    )
    pattern_distance: Distance | None = Field(
        None, alias="patternDistance", serialization_alias="patternDistance"
    )
    pattern_dosage: Dosage | None = Field(
        None, alias="patternDosage", serialization_alias="patternDosage"
    )
    pattern_duration: Duration | None = Field(
        None, alias="patternDuration", serialization_alias="patternDuration"
    )
    pattern_expression: Expression | None = Field(
        None, alias="patternExpression", serialization_alias="patternExpression"
    )
    pattern_human_name: HumanName | None = Field(
        None, alias="patternHumanName", serialization_alias="patternHumanName"
    )
    pattern_id: str | None = Field(
        None, alias="patternId", serialization_alias="patternId"
    )
    pattern_identifier: Identifier | None = Field(
        None, alias="patternIdentifier", serialization_alias="patternIdentifier"
    )
    pattern_instant: str | None = Field(
        None, alias="patternInstant", serialization_alias="patternInstant"
    )
    pattern_integer: int | None = Field(
        None, alias="patternInteger", serialization_alias="patternInteger"
    )
    pattern_markdown: str | None = Field(
        None, alias="patternMarkdown", serialization_alias="patternMarkdown"
    )
    pattern_meta: Meta | None = Field(
        None, alias="patternMeta", serialization_alias="patternMeta"
    )
    pattern_money: Money | None = Field(
        None, alias="patternMoney", serialization_alias="patternMoney"
    )
    pattern_oid: str | None = Field(
        None, alias="patternOid", serialization_alias="patternOid"
    )
    pattern_parameter_definition: ParameterDefinition | None = Field(
        None,
        alias="patternParameterDefinition",
        serialization_alias="patternParameterDefinition",
    )
    pattern_period: Period | None = Field(
        None, alias="patternPeriod", serialization_alias="patternPeriod"
    )
    pattern_positive_int: PositiveInt | None = Field(
        None, alias="patternPositiveInt", serialization_alias="patternPositiveInt"
    )
    pattern_quantity: Quantity | None = Field(
        None, alias="patternQuantity", serialization_alias="patternQuantity"
    )
    pattern_range: Range | None = Field(
        None, alias="patternRange", serialization_alias="patternRange"
    )
    pattern_ratio: Ratio | None = Field(
        None, alias="patternRatio", serialization_alias="patternRatio"
    )
    pattern_reference: Reference | None = Field(
        None, alias="patternReference", serialization_alias="patternReference"
    )
    pattern_related_artifact: RelatedArtifact | None = Field(
        None,
        alias="patternRelatedArtifact",
        serialization_alias="patternRelatedArtifact",
    )
    pattern_sampled_data: SampledData | None = Field(
        None, alias="patternSampledData", serialization_alias="patternSampledData"
    )
    pattern_signature: Signature | None = Field(
        None, alias="patternSignature", serialization_alias="patternSignature"
    )
    pattern_string: str | None = Field(
        None, alias="patternString", serialization_alias="patternString"
    )
    pattern_time: str | None = Field(
        None, alias="patternTime", serialization_alias="patternTime"
    )
    pattern_timing: Timing | None = Field(
        None, alias="patternTiming", serialization_alias="patternTiming"
    )
    pattern_trigger_definition: TriggerDefinition | None = Field(
        None,
        alias="patternTriggerDefinition",
        serialization_alias="patternTriggerDefinition",
    )
    pattern_unsigned_int: int | None = Field(
        None, alias="patternUnsignedInt", serialization_alias="patternUnsignedInt"
    )
    pattern_uri: str | None = Field(
        None, alias="patternUri", serialization_alias="patternUri"
    )
    pattern_url: str | None = Field(
        None, alias="patternUrl", serialization_alias="patternUrl"
    )
    pattern_usage_context: UsageContext | None = Field(
        None, alias="patternUsageContext", serialization_alias="patternUsageContext"
    )
    pattern_uuid: str | None = Field(
        None, alias="patternUuid", serialization_alias="patternUuid"
    )
    representation: (
        PyList[Literal["xmlAttr", "xmlText", "typeAttr", "cdaText", "xhtml"]] | None
    ) = Field(None, alias="representation", serialization_alias="representation")
    requirements: str | None = Field(
        None, alias="requirements", serialization_alias="requirements"
    )
    short: str | None = Field(None, alias="short", serialization_alias="short")
    slice_is_constraining: bool | None = Field(
        None, alias="sliceIsConstraining", serialization_alias="sliceIsConstraining"
    )
    slice_name: str | None = Field(
        None, alias="sliceName", serialization_alias="sliceName"
    )
    slicing: ElementDefinitionSlicing | None = Field(
        None, alias="slicing", serialization_alias="slicing"
    )
    type: PyList[ElementDefinitionType] | None = Field(
        None, alias="type", serialization_alias="type"
    )


class Period(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    end: str | None = Field(None, alias="end", serialization_alias="end")
    start: str | None = Field(None, alias="start", serialization_alias="start")


class HumanName(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    family: str | None = Field(None, alias="family", serialization_alias="family")
    given: PyList[str] | None = Field(None, alias="given", serialization_alias="given")
    period: Period | None = Field(None, alias="period", serialization_alias="period")
    prefix: PyList[str] | None = Field(
        None, alias="prefix", serialization_alias="prefix"
    )
    suffix: PyList[str] | None = Field(
        None, alias="suffix", serialization_alias="suffix"
    )
    text: str | None = Field(None, alias="text", serialization_alias="text")
    use: (
        Literal["usual", "official", "temp", "nickname", "anonymous", "old", "maiden"]
        | None
    ) = Field(None, alias="use", serialization_alias="use")


class RelatedArtifact(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    citation: str | None = Field(None, alias="citation", serialization_alias="citation")
    display: str | None = Field(None, alias="display", serialization_alias="display")
    document: Attachment | None = Field(
        None, alias="document", serialization_alias="document"
    )
    label: str | None = Field(None, alias="label", serialization_alias="label")
    resource: str | None = Field(None, alias="resource", serialization_alias="resource")
    type: Literal[
        "documentation",
        "justification",
        "citation",
        "predecessor",
        "successor",
        "derived-from",
        "depends-on",
        "composed-of",
    ] = Field(alias="type", serialization_alias="type")
    url: str | None = Field(None, alias="url", serialization_alias="url")


class Expression(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    description: str | None = Field(
        None, alias="description", serialization_alias="description"
    )
    expression: str | None = Field(
        None, alias="expression", serialization_alias="expression"
    )
    language: str = Field(alias="language", serialization_alias="language")
    name: str | None = Field(None, alias="name", serialization_alias="name")
    reference: str | None = Field(
        None, alias="reference", serialization_alias="reference"
    )


class MarketingStatus(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    country: CodeableConcept = Field(alias="country", serialization_alias="country")
    date_range: Period = Field(alias="dateRange", serialization_alias="dateRange")
    jurisdiction: CodeableConcept | None = Field(
        None, alias="jurisdiction", serialization_alias="jurisdiction"
    )
    restore_date: str | None = Field(
        None, alias="restoreDate", serialization_alias="restoreDate"
    )
    status: CodeableConcept = Field(alias="status", serialization_alias="status")


class Signature(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    data: str | None = Field(None, alias="data", serialization_alias="data")
    on_behalf_of: Reference | None = Field(
        None, alias="onBehalfOf", serialization_alias="onBehalfOf"
    )
    sig_format: str | None = Field(
        None, alias="sigFormat", serialization_alias="sigFormat"
    )
    target_format: str | None = Field(
        None, alias="targetFormat", serialization_alias="targetFormat"
    )
    type: PyList[Coding] = Field(alias="type", serialization_alias="type")
    when: str = Field(alias="when", serialization_alias="when")
    who: Reference = Field(alias="who", serialization_alias="who")


class SubstanceAmountReferenceRange(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    high_limit: Quantity | None = Field(
        None, alias="highLimit", serialization_alias="highLimit"
    )
    low_limit: Quantity | None = Field(
        None, alias="lowLimit", serialization_alias="lowLimit"
    )


class SubstanceAmount(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    amount_quantity: Quantity | None = Field(
        None, alias="amountQuantity", serialization_alias="amountQuantity"
    )
    amount_range: Range | None = Field(
        None, alias="amountRange", serialization_alias="amountRange"
    )
    amount_string: str | None = Field(
        None, alias="amountString", serialization_alias="amountString"
    )
    amount_text: str | None = Field(
        None, alias="amountText", serialization_alias="amountText"
    )
    amount_type: CodeableConcept | None = Field(
        None, alias="amountType", serialization_alias="amountType"
    )
    reference_range: SubstanceAmountReferenceRange | None = Field(
        None, alias="referenceRange", serialization_alias="referenceRange"
    )


class Contributor(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    contact: PyList[ContactDetail] | None = Field(
        None, alias="contact", serialization_alias="contact"
    )
    name: str = Field(alias="name", serialization_alias="name")
    type: Literal["author", "editor", "reviewer", "endorser"] = Field(
        alias="type", serialization_alias="type"
    )


class UsageContext(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code: Coding = Field(alias="code", serialization_alias="code")
    value_codeable_concept: CodeableConcept | None = Field(
        None, alias="valueCodeableConcept", serialization_alias="valueCodeableConcept"
    )
    value_quantity: Quantity | None = Field(
        None, alias="valueQuantity", serialization_alias="valueQuantity"
    )
    value_range: Range | None = Field(
        None, alias="valueRange", serialization_alias="valueRange"
    )
    value_reference: Reference | None = Field(
        None, alias="valueReference", serialization_alias="valueReference"
    )


class Meta(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    last_updated: str | None = Field(
        None, alias="lastUpdated", serialization_alias="lastUpdated"
    )
    profile: PyList[str] | None = Field(
        None, alias="profile", serialization_alias="profile"
    )
    security: PyList[Coding] | None = Field(
        None, alias="security", serialization_alias="security"
    )
    source: str | None = Field(None, alias="source", serialization_alias="source")
    tag: PyList[Coding] | None = Field(None, alias="tag", serialization_alias="tag")
    version_id: str | None = Field(
        None, alias="versionId", serialization_alias="versionId"
    )


class Distance(Quantity):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    pass


class ContactPoint(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    period: Period | None = Field(None, alias="period", serialization_alias="period")
    rank: PositiveInt | None = Field(None, alias="rank", serialization_alias="rank")
    system: Literal["phone", "fax", "email", "pager", "url", "sms", "other"] | None = (
        Field(None, alias="system", serialization_alias="system")
    )
    use: Literal["home", "work", "temp", "old", "mobile"] | None = Field(
        None, alias="use", serialization_alias="use"
    )
    value: str | None = Field(None, alias="value", serialization_alias="value")


class Annotation(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    author_reference: Reference | None = Field(
        None, alias="authorReference", serialization_alias="authorReference"
    )
    author_string: str | None = Field(
        None, alias="authorString", serialization_alias="authorString"
    )
    text: str = Field(alias="text", serialization_alias="text")
    time: str | None = Field(None, alias="time", serialization_alias="time")


class Attachment(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    content_type: str | None = Field(
        None, alias="contentType", serialization_alias="contentType"
    )
    creation: str | None = Field(None, alias="creation", serialization_alias="creation")
    data: str | None = Field(None, alias="data", serialization_alias="data")
    hash: str | None = Field(None, alias="hash", serialization_alias="hash")
    language: str | None = Field(None, alias="language", serialization_alias="language")
    size: int | None = Field(None, alias="size", serialization_alias="size")
    title: str | None = Field(None, alias="title", serialization_alias="title")
    url: str | None = Field(None, alias="url", serialization_alias="url")


class Narrative(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    div: str = Field(alias="div", serialization_alias="div")
    status: Literal["generated", "extensions", "additional", "empty"] = Field(
        alias="status", serialization_alias="status"
    )


class TriggerDefinition(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    condition: Expression | None = Field(
        None, alias="condition", serialization_alias="condition"
    )
    data: PyList[DataRequirement] | None = Field(
        None, alias="data", serialization_alias="data"
    )
    name: str | None = Field(None, alias="name", serialization_alias="name")
    timing_date: str | None = Field(
        None, alias="timingDate", serialization_alias="timingDate"
    )
    timing_date_time: str | None = Field(
        None, alias="timingDateTime", serialization_alias="timingDateTime"
    )
    timing_reference: Reference | None = Field(
        None, alias="timingReference", serialization_alias="timingReference"
    )
    timing_timing: Timing | None = Field(
        None, alias="timingTiming", serialization_alias="timingTiming"
    )
    type: Literal[
        "named-event",
        "periodic",
        "data-changed",
        "data-accessed",
        "data-access-ended",
        "data-added",
        "data-modified",
        "data-removed",
    ] = Field(alias="type", serialization_alias="type")


class Range(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    high: Quantity | None = Field(None, alias="high", serialization_alias="high")
    low: Quantity | None = Field(None, alias="low", serialization_alias="low")


class CodeableConcept(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    coding: PyList[Coding] | None = Field(
        None, alias="coding", serialization_alias="coding"
    )
    text: str | None = Field(None, alias="text", serialization_alias="text")


class DataRequirementCodeFilter(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code: PyList[Coding] | None = Field(None, alias="code", serialization_alias="code")
    path: str | None = Field(None, alias="path", serialization_alias="path")
    search_param: str | None = Field(
        None, alias="searchParam", serialization_alias="searchParam"
    )
    value_set: str | None = Field(
        None, alias="valueSet", serialization_alias="valueSet"
    )


class DataRequirementDateFilter(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    path: str | None = Field(None, alias="path", serialization_alias="path")
    search_param: str | None = Field(
        None, alias="searchParam", serialization_alias="searchParam"
    )
    value_date_time: str | None = Field(
        None, alias="valueDateTime", serialization_alias="valueDateTime"
    )
    value_duration: Duration | None = Field(
        None, alias="valueDuration", serialization_alias="valueDuration"
    )
    value_period: Period | None = Field(
        None, alias="valuePeriod", serialization_alias="valuePeriod"
    )


class DataRequirementSort(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    direction: Literal["ascending", "descending"] = Field(
        alias="direction", serialization_alias="direction"
    )
    path: str = Field(alias="path", serialization_alias="path")


class DataRequirement(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code_filter: PyList[DataRequirementCodeFilter] | None = Field(
        None, alias="codeFilter", serialization_alias="codeFilter"
    )
    date_filter: PyList[DataRequirementDateFilter] | None = Field(
        None, alias="dateFilter", serialization_alias="dateFilter"
    )
    limit: PositiveInt | None = Field(None, alias="limit", serialization_alias="limit")
    must_support: PyList[str] | None = Field(
        None, alias="mustSupport", serialization_alias="mustSupport"
    )
    profile: PyList[str] | None = Field(
        None, alias="profile", serialization_alias="profile"
    )
    sort: PyList[DataRequirementSort] | None = Field(
        None, alias="sort", serialization_alias="sort"
    )
    subject_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="subjectCodeableConcept",
        serialization_alias="subjectCodeableConcept",
    )
    subject_reference: Reference | None = Field(
        None, alias="subjectReference", serialization_alias="subjectReference"
    )
    type: Literal[
        "Address",
        "Age",
        "Annotation",
        "Attachment",
        "BackboneElement",
        "CodeableConcept",
        "Coding",
        "ContactDetail",
        "ContactPoint",
        "Contributor",
        "Count",
        "DataRequirement",
        "Distance",
        "Dosage",
        "Duration",
        "Element",
        "ElementDefinition",
        "Expression",
        "Extension",
        "HumanName",
        "Identifier",
        "MarketingStatus",
        "Meta",
        "Money",
        "MoneyQuantity",
        "Narrative",
        "ParameterDefinition",
        "Period",
        "Population",
        "ProdCharacteristic",
        "ProductShelfLife",
        "Quantity",
        "Range",
        "Ratio",
        "Reference",
        "RelatedArtifact",
        "SampledData",
        "Signature",
        "SimpleQuantity",
        "SubstanceAmount",
        "Timing",
        "TriggerDefinition",
        "UsageContext",
        "base64Binary",
        "boolean",
        "canonical",
        "code",
        "date",
        "dateTime",
        "decimal",
        "id",
        "instant",
        "integer",
        "markdown",
        "oid",
        "positiveInt",
        "string",
        "time",
        "unsignedInt",
        "uri",
        "url",
        "uuid",
        "xhtml",
        "Account",
        "ActivityDefinition",
        "AdverseEvent",
        "AllergyIntolerance",
        "Appointment",
        "AppointmentResponse",
        "AuditEvent",
        "Basic",
        "Binary",
        "BiologicallyDerivedProduct",
        "BodyStructure",
        "Bundle",
        "CapabilityStatement",
        "CarePlan",
        "CareTeam",
        "CatalogEntry",
        "ChargeItem",
        "ChargeItemDefinition",
        "Claim",
        "ClaimResponse",
        "ClinicalImpression",
        "CodeSystem",
        "Communication",
        "CommunicationRequest",
        "CompartmentDefinition",
        "Composition",
        "ConceptMap",
        "Condition",
        "Consent",
        "Contract",
        "Coverage",
        "CoverageEligibilityRequest",
        "CoverageEligibilityResponse",
        "DetectedIssue",
        "Device",
        "DeviceDefinition",
        "DeviceMetric",
        "DeviceRequest",
        "DeviceUseStatement",
        "DiagnosticReport",
        "DocumentManifest",
        "DocumentReference",
        "DomainResource",
        "EffectEvidenceSynthesis",
        "Encounter",
        "Endpoint",
        "EnrollmentRequest",
        "EnrollmentResponse",
        "EpisodeOfCare",
        "EventDefinition",
        "Evidence",
        "EvidenceVariable",
        "ExampleScenario",
        "ExplanationOfBenefit",
        "FamilyMemberHistory",
        "Flag",
        "Goal",
        "GraphDefinition",
        "Group",
        "GuidanceResponse",
        "HealthcareService",
        "ImagingStudy",
        "Immunization",
        "ImmunizationEvaluation",
        "ImmunizationRecommendation",
        "ImplementationGuide",
        "InsurancePlan",
        "Invoice",
        "Library",
        "Linkage",
        "List",
        "Location",
        "Measure",
        "MeasureReport",
        "Media",
        "Medication",
        "MedicationAdministration",
        "MedicationDispense",
        "MedicationKnowledge",
        "MedicationRequest",
        "MedicationStatement",
        "MedicinalProduct",
        "MedicinalProductAuthorization",
        "MedicinalProductContraindication",
        "MedicinalProductIndication",
        "MedicinalProductIngredient",
        "MedicinalProductInteraction",
        "MedicinalProductManufactured",
        "MedicinalProductPackaged",
        "MedicinalProductPharmaceutical",
        "MedicinalProductUndesirableEffect",
        "MessageDefinition",
        "MessageHeader",
        "MolecularSequence",
        "NamingSystem",
        "NutritionOrder",
        "Observation",
        "ObservationDefinition",
        "OperationDefinition",
        "OperationOutcome",
        "Organization",
        "OrganizationAffiliation",
        "Parameters",
        "Patient",
        "PaymentNotice",
        "PaymentReconciliation",
        "Person",
        "PlanDefinition",
        "Practitioner",
        "PractitionerRole",
        "Procedure",
        "Provenance",
        "Questionnaire",
        "QuestionnaireResponse",
        "RelatedPerson",
        "RequestGroup",
        "ResearchDefinition",
        "ResearchElementDefinition",
        "ResearchStudy",
        "ResearchSubject",
        "Resource",
        "RiskAssessment",
        "RiskEvidenceSynthesis",
        "Schedule",
        "SearchParameter",
        "ServiceRequest",
        "Slot",
        "Specimen",
        "SpecimenDefinition",
        "StructureDefinition",
        "StructureMap",
        "Subscription",
        "Substance",
        "SubstanceNucleicAcid",
        "SubstancePolymer",
        "SubstanceProtein",
        "SubstanceReferenceInformation",
        "SubstanceSourceMaterial",
        "SubstanceSpecification",
        "SupplyDelivery",
        "SupplyRequest",
        "Task",
        "TerminologyCapabilities",
        "TestReport",
        "TestScript",
        "ValueSet",
        "VerificationResult",
        "VisionPrescription",
        "Type",
        "Any",
    ] = Field(alias="type", serialization_alias="type")


class Money(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    currency: str | None = Field(None, alias="currency", serialization_alias="currency")
    value: float | None = Field(None, alias="value", serialization_alias="value")


class Identifier(Element):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    assigner: Reference | None = Field(
        None, alias="assigner", serialization_alias="assigner"
    )
    period: Period | None = Field(None, alias="period", serialization_alias="period")
    system: str | None = Field(None, alias="system", serialization_alias="system")
    type: CodeableConcept | None = Field(None, alias="type", serialization_alias="type")
    use: Literal["usual", "official", "temp", "secondary", "old"] | None = Field(
        None, alias="use", serialization_alias="use"
    )
    value: str | None = Field(None, alias="value", serialization_alias="value")


class TimingRepeat(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    bounds_duration: Duration | None = Field(
        None, alias="boundsDuration", serialization_alias="boundsDuration"
    )
    bounds_period: Period | None = Field(
        None, alias="boundsPeriod", serialization_alias="boundsPeriod"
    )
    bounds_range: Range | None = Field(
        None, alias="boundsRange", serialization_alias="boundsRange"
    )
    count: PositiveInt | None = Field(None, alias="count", serialization_alias="count")
    count_max: PositiveInt | None = Field(
        None, alias="countMax", serialization_alias="countMax"
    )
    day_of_week: (
        PyList[Literal["mon", "tue", "wed", "thu", "fri", "sat", "sun"]] | None
    ) = Field(None, alias="dayOfWeek", serialization_alias="dayOfWeek")
    duration: float | None = Field(
        None, alias="duration", serialization_alias="duration"
    )
    duration_max: float | None = Field(
        None, alias="durationMax", serialization_alias="durationMax"
    )
    duration_unit: Literal["s", "min", "h", "d", "wk", "mo", "a"] | None = Field(
        None, alias="durationUnit", serialization_alias="durationUnit"
    )
    frequency: PositiveInt | None = Field(
        None, alias="frequency", serialization_alias="frequency"
    )
    frequency_max: PositiveInt | None = Field(
        None, alias="frequencyMax", serialization_alias="frequencyMax"
    )
    offset: int | None = Field(None, alias="offset", serialization_alias="offset")
    period: float | None = Field(None, alias="period", serialization_alias="period")
    period_max: float | None = Field(
        None, alias="periodMax", serialization_alias="periodMax"
    )
    period_unit: Literal["s", "min", "h", "d", "wk", "mo", "a"] | None = Field(
        None, alias="periodUnit", serialization_alias="periodUnit"
    )
    time_of_day: PyList[str] | None = Field(
        None, alias="timeOfDay", serialization_alias="timeOfDay"
    )
    when: (
        PyList[
            Literal[
                "MORN",
                "MORN.early",
                "MORN.late",
                "NOON",
                "AFT",
                "AFT.early",
                "AFT.late",
                "EVE",
                "EVE.early",
                "EVE.late",
                "NIGHT",
                "PHS",
                "HS",
                "WAKE",
                "C",
                "CM",
                "CD",
                "CV",
                "AC",
                "ACM",
                "ACD",
                "ACV",
                "PC",
                "PCM",
                "PCD",
                "PCV",
            ]
        ]
        | None
    ) = Field(None, alias="when", serialization_alias="when")


class Timing(BackboneElement):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    code: CodeableConcept | None = Field(None, alias="code", serialization_alias="code")
    event: PyList[str] | None = Field(None, alias="event", serialization_alias="event")
    repeat: TimingRepeat | None = Field(
        None, alias="repeat", serialization_alias="repeat"
    )
