# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...commons.types.date import Date
from ...commons.types.encounter_external_id import EncounterExternalId


class AllocationEarmarkType_DateOfService(UniversalBaseModel):
    value: Date
    type: typing.Literal["date_of_service"] = "date_of_service"

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True


class AllocationEarmarkType_ExternalEncounterId(UniversalBaseModel):
    value: EncounterExternalId
    type: typing.Literal["external_encounter_id"] = "external_encounter_id"

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True


AllocationEarmarkType = typing_extensions.Annotated[
    typing.Union[AllocationEarmarkType_DateOfService, AllocationEarmarkType_ExternalEncounterId],
    pydantic.Field(discriminator="type"),
]
