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

from ....core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from ...commons.types.street_address_long_zip import StreetAddressLongZip
from ....core.pydantic_utilities import IS_PYDANTIC_V2


class EncounterServiceFacilityBase(UniversalBaseModel):
    """
    Encounter Service facility is typically the location a medical service was rendered, such as a provider office or hospital.
    For telehealth, service facility can represent the provider's location when the service was delivered (e.g., home),
    or the location where an in-person visit would have taken place, whichever is easier to identify.
    If the provider is in-network, service facility may be defined in payer contracts.
    Box 32 on the CMS-1500 claim form.
    Note that for an in-network claim to be successfully adjudicated, the service facility address listed on claims
    must match what was provided to the payer during the credentialing process.
    """

    organization_name: str
    npi: typing.Optional[str] = pydantic.Field(default=None)
    """
    An NPI specific to the service facility if applicable, i.e. if it has one and is not under the billing provider's NPI.
    Box 32 section (a) of the CMS-1500 claim form.
    """

    address: StreetAddressLongZip = pydantic.Field()
    """
    zip_plus_four_code is required for service facility address. When the zip_plus_four_code is not available use "9998" as per CMS documentation.
    """

    secondary_identification: typing.Optional[str] = pydantic.Field(default=None)
    """
    An additional identifier for the service facility other than the facility's NPI. Some payers may require this field.
    Potential examples: state license number, provider commercial number, or location number.
    Box 32 section (b) of the CMS-1500 claim form.
    """

    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
