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

import datetime as dt
import typing

import pydantic

from ......core.datetime_utils import serialize_datetime
from ......core.pydantic_utilities import deep_union_pydantic_dicts
from .payer_uuid import PayerUuid


class Payer(pydantic.BaseModel):
    """
    Examples
    --------
    import uuid

    from candid.resources.payers.v_3 import Payer

    Payer(
        payer_uuid=uuid.UUID(
            "a6431fd2-0712-4714-b1b1-dd094daf9f42",
        ),
        payer_id="12345",
        payer_name="Payer Name",
        availity_payer_name="Availity Payer Name",
        availity_claims_payer_id="54321",
        availity_eligibility_id="54321",
        availity_remittance_payer_id="54321",
    )
    """

    payer_uuid: PayerUuid = pydantic.Field()
    """
    Auto-generated ID set on creation.
    """

    payer_id: str = pydantic.Field()
    """
    The primary national payer ID of the payer.
    """

    payer_name: str = pydantic.Field()
    """
    The primary display name of the payer.
    """

    availity_payer_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the payer as it appears in Availity.
    """

    availity_claims_payer_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the payer as it appears in Availity.
    """

    availity_eligibility_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The eligibility ID of the payer as it appears in Availity.
    """

    availity_remittance_payer_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The remittance ID of the payer as it appears in Availity.
    """

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

        return deep_union_pydantic_dicts(
            super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
        )

    class Config:
        frozen = True
        smart_union = True
        extra = pydantic.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}
