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

import typing

import pydantic
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ...commons.types.state import State
from ...encounter_providers.resources.v_2.types.rendering_provider_update import RenderingProviderUpdate
from ...encounters.resources.v_4.types.encounter_submission_expectation import EncounterSubmissionExpectation
from ...health_care_code_information.resources.v_1.types.health_care_code_information_update import (
    HealthCareCodeInformationUpdate,
)
from ...x_12.resources.v_1.types.patient_discharge_status_code import PatientDischargeStatusCode
from ...x_12.resources.v_1.types.point_of_origin_for_admission_or_visit_code import PointOfOriginForAdmissionOrVisitCode
from ...x_12.resources.v_1.types.type_of_admission_or_visit_code import TypeOfAdmissionOrVisitCode
from ...x_12.resources.v_1.types.type_of_bill_composite_update import TypeOfBillCompositeUpdate
from .universal_encounter_update_base import UniversalEncounterUpdateBase


class UniversalEncounterUpdate(UniversalEncounterUpdateBase):
    health_care_code_information: typing.Optional[HealthCareCodeInformationUpdate] = pydantic.Field(default=None)
    """
    The health care code information associated with this encounter, which includes things such as diagnoses, vitals, procedures, occurrences, reason for visit, and numerous other code related fields.
    """

    attending_provider: typing.Optional[RenderingProviderUpdate] = pydantic.Field(default=None)
    """
    837i NM1 2500 variant for Loop ID-2310.  Used to indicate the individual whom has overall responsibility for the patient in institutional claims processing.
    """

    admission_hour: typing.Optional[int] = pydantic.Field(default=None)
    """
    837i Loop 2300 DTP-03
    Extension of the admission date with hour (0-23 integer) details.
    """

    admission_type_code: typing.Optional[TypeOfAdmissionOrVisitCode] = pydantic.Field(default=None)
    """
    837i Loop 2300 CL1-01 Code used to indicate the priority of an admission or visit. Equivalent to Form Locator 14 Priority of Admission on a UB-04 claim, not used on CMS-1500 claim forms.
    """

    admission_source_code: typing.Optional[PointOfOriginForAdmissionOrVisitCode] = pydantic.Field(default=None)
    """
    837i Loop 2300 CLI1-02 Code used to indicate the conditions under which an admission occurs. Equivalent to Form Locator 15 Point of Origin on a UB-04 claim, not used on CMS-1500 claim forms.
    """

    discharge_hour: typing.Optional[int] = pydantic.Field(default=None)
    """
    837i Loop 2300 DTP-03
    Extension of the discharge date with hour (0-23 integer) details.
    """

    discharge_status: typing.Optional[PatientDischargeStatusCode] = pydantic.Field(default=None)
    """
    837i CL1-03 or Form Locator 17 on a UB-04 claim form. This is a required field on UB-04 claims.
    Code indicating patient status as of the "statement covers through date".
    """

    operating_provider: typing.Optional[RenderingProviderUpdate] = pydantic.Field(default=None)
    """
    837i NM1 2500 variant for Loop ID-2310.  Used to indicate the individual whom has primary responsibility for surgical procedures in institutional claims processing.
    """

    other_operating_provider: typing.Optional[RenderingProviderUpdate] = pydantic.Field(default=None)
    """
    837i NM1 2500 variant for Loop ID-2310.  Used to indicate the individual whom has secondary responsibility for surgical procedures in institutional claims processing.  Only used when operating_provider is also set.
    """

    type_of_bill: typing.Optional[TypeOfBillCompositeUpdate] = pydantic.Field(default=None)
    """
    Four digit code used in institutional forms to indicate the type of bill (e.g., hospital inpatient, hospital outpatient). First digit is a leading 0, followed by the type_of_facility, type_of_care, then frequency_code. Professional forms are not required to submit this attribute. You may send the 4 digit code via raw_code, or each individual digit separately via composite_codes.
    """

    accident_state_or_province_code: typing.Optional[State] = pydantic.Field(default=None)
    """
    837i-REF1000 -- an optional state indicating where an accident related to the encounter occurred.
    """

    submission_expectation: typing.Optional[EncounterSubmissionExpectation] = pydantic.Field(default=None)
    """
    Describes the currently expected target form for this encounter.  This effects what validations and queues the form is processed under.  When this value is not set, it should be assumed to be TARGET_PROFESSIONAL.
    """

    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
