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

from ......core.pydantic_utilities import UniversalBaseModel
from .write_off_id import WriteOffId
from .....payers.resources.v_3.types.payer import Payer
from .insurance_write_off_target import InsuranceWriteOffTarget
import datetime as dt
import typing
from .insurance_write_off_reason import InsuranceWriteOffReason
from ......core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class InsuranceWriteOff(UniversalBaseModel):
    write_off_id: WriteOffId
    payer: Payer
    write_off_target: InsuranceWriteOffTarget
    write_off_timestamp: dt.datetime
    write_off_note: typing.Optional[str] = None
    write_off_reason: InsuranceWriteOffReason
    reverts_write_off_id: typing.Optional[WriteOffId] = None
    reverted_by_write_off_id: typing.Optional[WriteOffId] = None
    amount_cents: int

    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
