# 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 ConfigDict, Field, PositiveInt
from typing import List as PyList

from fhirschemapy.R4B.base import (
    Address,
    Age,
    Annotation,
    Attachment,
    BackboneElement,
    CodeableConcept,
    Coding,
    ContactDetail,
    ContactPoint,
    Contributor,
    Count,
    DataRequirement,
    Distance,
    Dosage,
    Duration,
    Expression,
    HumanName,
    Identifier,
    Meta,
    Money,
    ParameterDefinition,
    Period,
    Quantity,
    Range,
    Ratio,
    Reference,
    RelatedArtifact,
    SampledData,
    Signature,
    Timing,
    TriggerDefinition,
    UsageContext,
)
from fhirschemapy.R4B.resource import Resource
from fhirschemapy.R4B.resource_families import ResourceFamily


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

    name: str = Field(alias="name", serialization_alias="name")
    part: PyList[ParametersParameter] | None = Field(
        None, alias="part", serialization_alias="part"
    )
    resource: ResourceFamily | None = Field(
        None, alias="resource", serialization_alias="resource"
    )
    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 Parameters(Resource):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    resource_type: str = Field(
        default="Parameters",
        alias="resourceType",
        serialization_alias="resourceType",
        frozen=True,
        pattern="Parameters",
    )

    parameter: PyList[ParametersParameter] | None = Field(
        None, alias="parameter", serialization_alias="parameter"
    )

    def to_json(self, indent: int | None = None) -> str:
        return self.model_dump_json(
            exclude_unset=True, exclude_none=True, indent=indent
        )

    @classmethod
    def from_json(cls, json: str) -> Parameters:
        return cls.model_validate_json(json)
