# 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 ...v_2.types.authorized_signatory_update import AuthorizedSignatoryUpdate
from ...v_2.types.contract_status import ContractStatus
from ...v_2.types.date_update import DateUpdate
from ...v_2.types.insurance_types import InsuranceTypes
from ...v_2.types.regions_update import RegionsUpdate
from .contract_service_facility_id import ContractServiceFacilityId
from .rendering_providerid import RenderingProviderid


class ContractUpdateUnion_Professional(UniversalBaseModel):
    type: typing.Literal["professional"] = "professional"
    rendering_provider_ids: typing.Optional[typing.Set[RenderingProviderid]] = None
    effective_date: typing.Optional[Date] = None
    expiration_date: typing.Optional[DateUpdate] = None
    regions: typing.Optional[RegionsUpdate] = None
    contract_status: typing.Optional[ContractStatus] = None
    authorized_signatory: typing.Optional[AuthorizedSignatoryUpdate] = None
    commercial_insurance_types: typing.Optional[InsuranceTypes] = None
    medicare_insurance_types: typing.Optional[InsuranceTypes] = None
    medicaid_insurance_types: typing.Optional[InsuranceTypes] = None

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

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class ContractUpdateUnion_Institutional(UniversalBaseModel):
    type: typing.Literal["institutional"] = "institutional"
    contract_service_facility_ids: typing.Optional[typing.Set[ContractServiceFacilityId]] = None
    effective_date: typing.Optional[Date] = None
    expiration_date: typing.Optional[DateUpdate] = None
    regions: typing.Optional[RegionsUpdate] = None
    contract_status: typing.Optional[ContractStatus] = None
    authorized_signatory: typing.Optional[AuthorizedSignatoryUpdate] = None
    commercial_insurance_types: typing.Optional[InsuranceTypes] = None
    medicare_insurance_types: typing.Optional[InsuranceTypes] = None
    medicaid_insurance_types: typing.Optional[InsuranceTypes] = None

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

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


ContractUpdateUnion = typing_extensions.Annotated[
    typing.Union[ContractUpdateUnion_Professional, ContractUpdateUnion_Institutional],
    pydantic.Field(discriminator="type"),
]
