# 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 .currency_enum import CurrencyEnum
from .ocr_counterpart_details import OcrCounterpartDetails
from .ocr_receipt_line_item import OcrReceiptLineItem


class OcrReceipt(UniversalBaseModel):
    document_number: typing.Optional[str] = None
    issued_at: typing.Optional[dt.datetime] = None
    currency: typing.Optional[CurrencyEnum] = None
    subtotal: typing.Optional[float] = None
    tax_rate: typing.Optional[float] = None
    tax_amount: typing.Optional[float] = None
    total_amount: typing.Optional[float] = None
    discount: typing.Optional[float] = None
    tax_type: typing.Optional[str] = None
    line_items: typing.List[OcrReceiptLineItem]
    sender: OcrCounterpartDetails

    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
