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

import datetime as dt
import typing

from ......core.datetime_utils import serialize_datetime
from .....commons.types.date import Date
from .....identifiers.types.updatable_identifier import UpdatableIdentifier
from ...v_2.types.license_type import LicenseType
from ...v_2.types.organization_provider_address import OrganizationProviderAddress
from ...v_2.types.provider_type import ProviderType

try:
    import pydantic.v1 as pydantic  # type: ignore
except ImportError:
    import pydantic  # type: ignore


class OrganizationProviderUpdateV2(pydantic.BaseModel):
    npi: typing.Optional[str] = pydantic.Field(
        default=None,
        description="The NPI of the provider. This must be all digits [0-9] and exactly 10 characters long.",
    )
    is_rendering: typing.Optional[bool] = pydantic.Field(
        default=None, description="Whether the provider can be used to render services."
    )
    is_billing: typing.Optional[bool] = pydantic.Field(
        default=None, description="Whether the provider can be used to bill services."
    )
    first_name: typing.Optional[str] = pydantic.Field(
        default=None, description="The first name of the provider, if the provider is an individual."
    )
    last_name: typing.Optional[str] = pydantic.Field(
        default=None, description="The last name of the provider, if the provider is an individual."
    )
    organization_name: typing.Optional[str] = pydantic.Field(
        default=None, description="The name of the provider, if the provider is an organization."
    )
    provider_type: typing.Optional[ProviderType] = pydantic.Field(
        default=None,
        description="Whether the provider is an individual (NPPES Type 1) or organization (NPPES Type 2) provider.",
    )
    tax_id: typing.Optional[str] = pydantic.Field(
        default=None,
        description="If the provider has a contract with insurance, this must be the same tax ID given to the payer on an IRS W-9 form completed during contracting.",
    )
    taxonomy_code: typing.Optional[str] = pydantic.Field(
        default=None, description="A code designating classification and specialization."
    )
    license_type: typing.Optional[LicenseType] = pydantic.Field(
        default=None, description="The type of license that the provider holds."
    )
    addresses: typing.Optional[typing.List[OrganizationProviderAddress]] = pydantic.Field(
        default=None, description="The addresses associated with this provider."
    )
    employment_start_date: typing.Optional[Date] = pydantic.Field(
        default=None, description="The employment start date for the provider."
    )
    employment_termination_date: typing.Optional[Date] = pydantic.Field(
        default=None, description="The employment termination date for the provider."
    )
    qualifications: typing.Optional[typing.List[UpdatableIdentifier]] = pydantic.Field(
        default=None, description="Provider's qualifications (medicare provider number, medicaid provider number, etc.)"
    )

    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: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        json_encoders = {dt.datetime: serialize_datetime}
