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

import datetime as dt
import typing

import pydantic
from ......core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .....commons.types.service_line_id import ServiceLineId
from .insurance_adjustment_info import InsuranceAdjustmentInfo
from .insurance_payment_info import InsurancePaymentInfo
from .non_insurance_adjustment_info import NonInsuranceAdjustmentInfo
from .non_insurance_payment_info import NonInsurancePaymentInfo
from .patient_adjustment_info import PatientAdjustmentInfo
from .patient_payment_info import PatientPaymentInfo


class ServiceLineItemization(UniversalBaseModel):
    service_line_id: ServiceLineId = pydantic.Field()
    """
    The ID of the service line.
    """

    procedure_code: str = pydantic.Field()
    """
    The procedure code (CPT/HCPCS) associated with the service line.
    """

    date_of_service: dt.date = pydantic.Field()
    """
    The date of service for the service line.
    """

    patient_balance_cents: int = pydantic.Field()
    """
    The total patient balance in cents for the service line. Negative values indicate a credit balance.
    """

    charge_amount_cents: int = pydantic.Field()
    """
    The total charge amount in cents for the service line.
    """

    insurance_adjustments: InsuranceAdjustmentInfo
    insurance_payments: InsurancePaymentInfo
    non_insurance_adjustments: NonInsuranceAdjustmentInfo
    non_insurance_payments: NonInsurancePaymentInfo
    patient_adjustments: PatientAdjustmentInfo
    patient_payments: PatientPaymentInfo
    copay_cents: int = pydantic.Field()
    """
    The copay amount in cents for the service line.
    """

    coinsurance_cents: int = pydantic.Field()
    """
    The coinsurance amount in cents for the service line.
    """

    deductible_cents: int = pydantic.Field()
    """
    The deductible amount in cents for the service line.
    """

    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
