# 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, Literal

from fhirschemapy.R4B.base import (
    Address,
    Attachment,
    BackboneElement,
    CodeableConcept,
    Coding,
    Identifier,
    Money,
    Period,
    Quantity,
    Reference,
)
from fhirschemapy.R4B.domain_resource import DomainResource


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

    date: str | None = Field(None, alias="date", serialization_alias="date")
    location_address: Address | None = Field(
        None, alias="locationAddress", serialization_alias="locationAddress"
    )
    location_reference: Reference | None = Field(
        None, alias="locationReference", serialization_alias="locationReference"
    )
    type: CodeableConcept | None = Field(None, alias="type", serialization_alias="type")


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    body_site: CodeableConcept | None = Field(
        None, alias="bodySite", serialization_alias="bodySite"
    )
    detail: PyList[ExplanationOfBenefitAddItemDetail] | None = Field(
        None, alias="detail", serialization_alias="detail"
    )
    detail_sequence: PyList[PositiveInt] | None = Field(
        None, alias="detailSequence", serialization_alias="detailSequence"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    item_sequence: PyList[PositiveInt] | None = Field(
        None, alias="itemSequence", serialization_alias="itemSequence"
    )
    location_address: Address | None = Field(
        None, alias="locationAddress", serialization_alias="locationAddress"
    )
    location_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="locationCodeableConcept",
        serialization_alias="locationCodeableConcept",
    )
    location_reference: Reference | None = Field(
        None, alias="locationReference", serialization_alias="locationReference"
    )
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    program_code: PyList[CodeableConcept] | None = Field(
        None, alias="programCode", serialization_alias="programCode"
    )
    provider: PyList[Reference] | None = Field(
        None, alias="provider", serialization_alias="provider"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    serviced_date: str | None = Field(
        None, alias="servicedDate", serialization_alias="servicedDate"
    )
    serviced_period: Period | None = Field(
        None, alias="servicedPeriod", serialization_alias="servicedPeriod"
    )
    sub_detail_sequence: PyList[PositiveInt] | None = Field(
        None, alias="subDetailSequence", serialization_alias="subDetailSequence"
    )
    sub_site: PyList[CodeableConcept] | None = Field(
        None, alias="subSite", serialization_alias="subSite"
    )
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    sub_detail: PyList[ExplanationOfBenefitAddItemDetailSubDetail] | None = Field(
        None, alias="subDetail", serialization_alias="subDetail"
    )
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    category: CodeableConcept = Field(alias="category", serialization_alias="category")
    description: str | None = Field(
        None, alias="description", serialization_alias="description"
    )
    excluded: bool | None = Field(
        None, alias="excluded", serialization_alias="excluded"
    )
    financial: PyList[ExplanationOfBenefitBenefitBalanceFinancial] | None = Field(
        None, alias="financial", serialization_alias="financial"
    )
    name: str | None = Field(None, alias="name", serialization_alias="name")
    network: CodeableConcept | None = Field(
        None, alias="network", serialization_alias="network"
    )
    term: CodeableConcept | None = Field(None, alias="term", serialization_alias="term")
    unit: CodeableConcept | None = Field(None, alias="unit", serialization_alias="unit")


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

    allowed_money: Money | None = Field(
        None, alias="allowedMoney", serialization_alias="allowedMoney"
    )
    allowed_string: str | None = Field(
        None, alias="allowedString", serialization_alias="allowedString"
    )
    allowed_unsigned_int: int | None = Field(
        None, alias="allowedUnsignedInt", serialization_alias="allowedUnsignedInt"
    )
    type: CodeableConcept = Field(alias="type", serialization_alias="type")
    used_money: Money | None = Field(
        None, alias="usedMoney", serialization_alias="usedMoney"
    )
    used_unsigned_int: int | None = Field(
        None, alias="usedUnsignedInt", serialization_alias="usedUnsignedInt"
    )


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

    provider: Reference = Field(alias="provider", serialization_alias="provider")
    qualification: CodeableConcept | None = Field(
        None, alias="qualification", serialization_alias="qualification"
    )
    responsible: bool | None = Field(
        None, alias="responsible", serialization_alias="responsible"
    )
    role: CodeableConcept | None = Field(None, alias="role", serialization_alias="role")
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")


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

    diagnosis_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="diagnosisCodeableConcept",
        serialization_alias="diagnosisCodeableConcept",
    )
    diagnosis_reference: Reference | None = Field(
        None, alias="diagnosisReference", serialization_alias="diagnosisReference"
    )
    on_admission: CodeableConcept | None = Field(
        None, alias="onAdmission", serialization_alias="onAdmission"
    )
    package_code: CodeableConcept | None = Field(
        None, alias="packageCode", serialization_alias="packageCode"
    )
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    type: PyList[CodeableConcept] | None = Field(
        None, alias="type", serialization_alias="type"
    )


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

    coverage: Reference = Field(alias="coverage", serialization_alias="coverage")
    focal: bool = Field(alias="focal", serialization_alias="focal")
    pre_auth_ref: PyList[str] | None = Field(
        None, alias="preAuthRef", serialization_alias="preAuthRef"
    )


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    body_site: CodeableConcept | None = Field(
        None, alias="bodySite", serialization_alias="bodySite"
    )
    care_team_sequence: PyList[PositiveInt] | None = Field(
        None, alias="careTeamSequence", serialization_alias="careTeamSequence"
    )
    category: CodeableConcept | None = Field(
        None, alias="category", serialization_alias="category"
    )
    detail: PyList[ExplanationOfBenefitItemDetail] | None = Field(
        None, alias="detail", serialization_alias="detail"
    )
    diagnosis_sequence: PyList[PositiveInt] | None = Field(
        None, alias="diagnosisSequence", serialization_alias="diagnosisSequence"
    )
    encounter: PyList[Reference] | None = Field(
        None, alias="encounter", serialization_alias="encounter"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    information_sequence: PyList[PositiveInt] | None = Field(
        None, alias="informationSequence", serialization_alias="informationSequence"
    )
    location_address: Address | None = Field(
        None, alias="locationAddress", serialization_alias="locationAddress"
    )
    location_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="locationCodeableConcept",
        serialization_alias="locationCodeableConcept",
    )
    location_reference: Reference | None = Field(
        None, alias="locationReference", serialization_alias="locationReference"
    )
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    procedure_sequence: PyList[PositiveInt] | None = Field(
        None, alias="procedureSequence", serialization_alias="procedureSequence"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    program_code: PyList[CodeableConcept] | None = Field(
        None, alias="programCode", serialization_alias="programCode"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    revenue: CodeableConcept | None = Field(
        None, alias="revenue", serialization_alias="revenue"
    )
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    serviced_date: str | None = Field(
        None, alias="servicedDate", serialization_alias="servicedDate"
    )
    serviced_period: Period | None = Field(
        None, alias="servicedPeriod", serialization_alias="servicedPeriod"
    )
    sub_site: PyList[CodeableConcept] | None = Field(
        None, alias="subSite", serialization_alias="subSite"
    )
    udi: PyList[Reference] | None = Field(None, alias="udi", serialization_alias="udi")
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    amount: Money | None = Field(None, alias="amount", serialization_alias="amount")
    category: CodeableConcept = Field(alias="category", serialization_alias="category")
    reason: CodeableConcept | None = Field(
        None, alias="reason", serialization_alias="reason"
    )
    value: float | None = Field(None, alias="value", serialization_alias="value")


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    category: CodeableConcept | None = Field(
        None, alias="category", serialization_alias="category"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    program_code: PyList[CodeableConcept] | None = Field(
        None, alias="programCode", serialization_alias="programCode"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    revenue: CodeableConcept | None = Field(
        None, alias="revenue", serialization_alias="revenue"
    )
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    sub_detail: PyList[ExplanationOfBenefitItemDetailSubDetail] | None = Field(
        None, alias="subDetail", serialization_alias="subDetail"
    )
    udi: PyList[Reference] | None = Field(None, alias="udi", serialization_alias="udi")
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    category: CodeableConcept | None = Field(
        None, alias="category", serialization_alias="category"
    )
    factor: float | None = Field(None, alias="factor", serialization_alias="factor")
    modifier: PyList[CodeableConcept] | None = Field(
        None, alias="modifier", serialization_alias="modifier"
    )
    net: Money | None = Field(None, alias="net", serialization_alias="net")
    note_number: PyList[PositiveInt] | None = Field(
        None, alias="noteNumber", serialization_alias="noteNumber"
    )
    product_or_service: CodeableConcept = Field(
        alias="productOrService", serialization_alias="productOrService"
    )
    program_code: PyList[CodeableConcept] | None = Field(
        None, alias="programCode", serialization_alias="programCode"
    )
    quantity: Quantity | None = Field(
        None, alias="quantity", serialization_alias="quantity"
    )
    revenue: CodeableConcept | None = Field(
        None, alias="revenue", serialization_alias="revenue"
    )
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    udi: PyList[Reference] | None = Field(None, alias="udi", serialization_alias="udi")
    unit_price: Money | None = Field(
        None, alias="unitPrice", serialization_alias="unitPrice"
    )


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

    party: Reference | None = Field(None, alias="party", serialization_alias="party")
    type: CodeableConcept | None = Field(None, alias="type", serialization_alias="type")


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

    adjustment: Money | None = Field(
        None, alias="adjustment", serialization_alias="adjustment"
    )
    adjustment_reason: CodeableConcept | None = Field(
        None, alias="adjustmentReason", serialization_alias="adjustmentReason"
    )
    amount: Money | None = Field(None, alias="amount", serialization_alias="amount")
    date: str | None = Field(None, alias="date", serialization_alias="date")
    identifier: Identifier | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    type: CodeableConcept | None = Field(None, alias="type", serialization_alias="type")


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

    date: str | None = Field(None, alias="date", serialization_alias="date")
    procedure_codeable_concept: CodeableConcept | None = Field(
        None,
        alias="procedureCodeableConcept",
        serialization_alias="procedureCodeableConcept",
    )
    procedure_reference: Reference | None = Field(
        None, alias="procedureReference", serialization_alias="procedureReference"
    )
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    type: PyList[CodeableConcept] | None = Field(
        None, alias="type", serialization_alias="type"
    )
    udi: PyList[Reference] | None = Field(None, alias="udi", serialization_alias="udi")


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

    language: CodeableConcept | None = Field(
        None, alias="language", serialization_alias="language"
    )
    number: PositiveInt | None = Field(
        None, alias="number", serialization_alias="number"
    )
    text: str | None = Field(None, alias="text", serialization_alias="text")
    type: Literal["display", "print", "printoper"] | None = Field(
        None, alias="type", serialization_alias="type"
    )


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

    claim: Reference | None = Field(None, alias="claim", serialization_alias="claim")
    reference: Identifier | None = Field(
        None, alias="reference", serialization_alias="reference"
    )
    relationship: CodeableConcept | None = Field(
        None, alias="relationship", serialization_alias="relationship"
    )


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

    category: CodeableConcept = Field(alias="category", serialization_alias="category")
    code: CodeableConcept | None = Field(None, alias="code", serialization_alias="code")
    reason: Coding | None = Field(None, alias="reason", serialization_alias="reason")
    sequence: PositiveInt = Field(alias="sequence", serialization_alias="sequence")
    timing_date: str | None = Field(
        None, alias="timingDate", serialization_alias="timingDate"
    )
    timing_period: Period | None = Field(
        None, alias="timingPeriod", serialization_alias="timingPeriod"
    )
    value_attachment: Attachment | None = Field(
        None, alias="valueAttachment", serialization_alias="valueAttachment"
    )
    value_boolean: bool | None = Field(
        None, alias="valueBoolean", serialization_alias="valueBoolean"
    )
    value_quantity: Quantity | None = Field(
        None, alias="valueQuantity", serialization_alias="valueQuantity"
    )
    value_reference: Reference | None = Field(
        None, alias="valueReference", serialization_alias="valueReference"
    )
    value_string: str | None = Field(
        None, alias="valueString", serialization_alias="valueString"
    )


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

    amount: Money = Field(alias="amount", serialization_alias="amount")
    category: CodeableConcept = Field(alias="category", serialization_alias="category")


class ExplanationOfBenefit(DomainResource):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

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

    accident: ExplanationOfBenefitAccident | None = Field(
        None, alias="accident", serialization_alias="accident"
    )
    add_item: PyList[ExplanationOfBenefitAddItem] | None = Field(
        None, alias="addItem", serialization_alias="addItem"
    )
    adjudication: PyList[ExplanationOfBenefitItemAdjudication] | None = Field(
        None, alias="adjudication", serialization_alias="adjudication"
    )
    benefit_balance: PyList[ExplanationOfBenefitBenefitBalance] | None = Field(
        None, alias="benefitBalance", serialization_alias="benefitBalance"
    )
    benefit_period: Period | None = Field(
        None, alias="benefitPeriod", serialization_alias="benefitPeriod"
    )
    billable_period: Period | None = Field(
        None, alias="billablePeriod", serialization_alias="billablePeriod"
    )
    care_team: PyList[ExplanationOfBenefitCareTeam] | None = Field(
        None, alias="careTeam", serialization_alias="careTeam"
    )
    claim: Reference | None = Field(None, alias="claim", serialization_alias="claim")
    claim_response: Reference | None = Field(
        None, alias="claimResponse", serialization_alias="claimResponse"
    )
    created: str = Field(alias="created", serialization_alias="created")
    diagnosis: PyList[ExplanationOfBenefitDiagnosis] | None = Field(
        None, alias="diagnosis", serialization_alias="diagnosis"
    )
    disposition: str | None = Field(
        None, alias="disposition", serialization_alias="disposition"
    )
    enterer: Reference | None = Field(
        None, alias="enterer", serialization_alias="enterer"
    )
    facility: Reference | None = Field(
        None, alias="facility", serialization_alias="facility"
    )
    form: Attachment | None = Field(None, alias="form", serialization_alias="form")
    form_code: CodeableConcept | None = Field(
        None, alias="formCode", serialization_alias="formCode"
    )
    funds_reserve: CodeableConcept | None = Field(
        None, alias="fundsReserve", serialization_alias="fundsReserve"
    )
    funds_reserve_requested: CodeableConcept | None = Field(
        None, alias="fundsReserveRequested", serialization_alias="fundsReserveRequested"
    )
    identifier: PyList[Identifier] | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    insurance: PyList[ExplanationOfBenefitInsurance] = Field(
        alias="insurance", serialization_alias="insurance"
    )
    insurer: Reference = Field(alias="insurer", serialization_alias="insurer")
    item: PyList[ExplanationOfBenefitItem] | None = Field(
        None, alias="item", serialization_alias="item"
    )
    original_prescription: Reference | None = Field(
        None, alias="originalPrescription", serialization_alias="originalPrescription"
    )
    outcome: Literal["queued", "complete", "error", "partial"] = Field(
        alias="outcome", serialization_alias="outcome"
    )
    patient: Reference = Field(alias="patient", serialization_alias="patient")
    payee: ExplanationOfBenefitPayee | None = Field(
        None, alias="payee", serialization_alias="payee"
    )
    payment: ExplanationOfBenefitPayment | None = Field(
        None, alias="payment", serialization_alias="payment"
    )
    pre_auth_ref: PyList[str] | None = Field(
        None, alias="preAuthRef", serialization_alias="preAuthRef"
    )
    pre_auth_ref_period: PyList[Period] | None = Field(
        None, alias="preAuthRefPeriod", serialization_alias="preAuthRefPeriod"
    )
    precedence: PositiveInt | None = Field(
        None, alias="precedence", serialization_alias="precedence"
    )
    prescription: Reference | None = Field(
        None, alias="prescription", serialization_alias="prescription"
    )
    priority: CodeableConcept | None = Field(
        None, alias="priority", serialization_alias="priority"
    )
    procedure: PyList[ExplanationOfBenefitProcedure] | None = Field(
        None, alias="procedure", serialization_alias="procedure"
    )
    process_note: PyList[ExplanationOfBenefitProcessNote] | None = Field(
        None, alias="processNote", serialization_alias="processNote"
    )
    provider: Reference = Field(alias="provider", serialization_alias="provider")
    referral: Reference | None = Field(
        None, alias="referral", serialization_alias="referral"
    )
    related: PyList[ExplanationOfBenefitRelated] | None = Field(
        None, alias="related", serialization_alias="related"
    )
    status: Literal["active", "cancelled", "draft", "entered-in-error"] = Field(
        alias="status", serialization_alias="status"
    )
    sub_type: CodeableConcept | None = Field(
        None, alias="subType", serialization_alias="subType"
    )
    supporting_info: PyList[ExplanationOfBenefitSupportingInfo] | None = Field(
        None, alias="supportingInfo", serialization_alias="supportingInfo"
    )
    total: PyList[ExplanationOfBenefitTotal] | None = Field(
        None, alias="total", serialization_alias="total"
    )
    type: CodeableConcept = Field(alias="type", serialization_alias="type")
    use: Literal["claim", "preauthorization", "predetermination"] = Field(
        alias="use", serialization_alias="use"
    )

    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) -> ExplanationOfBenefit:
        return cls.model_validate_json(json)
