"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from abbyy_document_ai.types import BaseModel
from datetime import date
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ExpenseTypeTypedDict(TypedDict):
    r"""The type of the expense"""

    airfare: NotRequired[bool]
    r"""Receipts for booked flights"""
    car_parking: NotRequired[bool]
    r"""Receipts from parking meters"""
    car_rental: NotRequired[bool]
    r"""Receipts from car rental services"""
    gasoline_station: NotRequired[bool]
    r"""Receipts from gas stations"""
    general_retail: NotRequired[bool]
    r"""Receipts from stores, supermarkets, etc."""
    hotel: NotRequired[bool]
    r"""Receipts from hotels"""
    other: NotRequired[bool]
    r"""Other types of receipts"""
    restaurant: NotRequired[bool]
    r"""Restaurant bills"""
    taxi: NotRequired[bool]
    r"""Taxi receipts"""
    toll_road: NotRequired[bool]
    r"""Toll receipts"""
    transport: NotRequired[bool]
    r"""Receipts for public transportation fares"""


class ExpenseType(BaseModel):
    r"""The type of the expense"""

    airfare: Optional[bool] = None
    r"""Receipts for booked flights"""

    car_parking: Annotated[Optional[bool], pydantic.Field(alias="carParking")] = None
    r"""Receipts from parking meters"""

    car_rental: Annotated[Optional[bool], pydantic.Field(alias="carRental")] = None
    r"""Receipts from car rental services"""

    gasoline_station: Annotated[
        Optional[bool], pydantic.Field(alias="gasolineStation")
    ] = None
    r"""Receipts from gas stations"""

    general_retail: Annotated[Optional[bool], pydantic.Field(alias="generalRetail")] = (
        None
    )
    r"""Receipts from stores, supermarkets, etc."""

    hotel: Optional[bool] = None
    r"""Receipts from hotels"""

    other: Optional[bool] = None
    r"""Other types of receipts"""

    restaurant: Optional[bool] = None
    r"""Restaurant bills"""

    taxi: Optional[bool] = None
    r"""Taxi receipts"""

    toll_road: Annotated[Optional[bool], pydantic.Field(alias="tollRoad")] = None
    r"""Toll receipts"""

    transport: Optional[bool] = None
    r"""Receipts for public transportation fares"""


class TaxesTypedDict(TypedDict):
    r"""Tax details"""

    tax_amount: NotRequired[float]
    r"""The tax amount"""
    tax_rate: NotRequired[float]
    r"""The tax rate"""


class Taxes(BaseModel):
    r"""Tax details"""

    tax_amount: Annotated[Optional[float], pydantic.Field(alias="taxAmount")] = None
    r"""The tax amount"""

    tax_rate: Annotated[Optional[float], pydantic.Field(alias="taxRate")] = None
    r"""The tax rate"""


class ReceiptLineItemTypedDict(TypedDict):
    r"""A line item representing a purchased product or service in a receipt"""

    description: NotRequired[str]
    r"""The name of the purchased product or service"""
    sku: NotRequired[str]
    r"""The stock-keeping unit identifier of the product (if present)"""
    quantity: NotRequired[float]
    r"""The quantity of the product purchased"""
    price: NotRequired[float]
    r"""The price per unit"""
    amount: NotRequired[float]
    r"""The total sum in the line item"""


class ReceiptLineItem(BaseModel):
    r"""A line item representing a purchased product or service in a receipt"""

    description: Optional[str] = None
    r"""The name of the purchased product or service"""

    sku: Optional[str] = None
    r"""The stock-keeping unit identifier of the product (if present)"""

    quantity: Optional[float] = None
    r"""The quantity of the product purchased"""

    price: Optional[float] = None
    r"""The price per unit"""

    amount: Optional[float] = None
    r"""The total sum in the line item"""


class ReceiptFieldsTypedDict(TypedDict):
    r"""Fields extracted from a receipt"""

    vendor: NotRequired[str]
    r"""The name of the organization that issued the receipt"""
    address: NotRequired[str]
    r"""The address of the organization that issued the receipt"""
    city: NotRequired[str]
    r"""The city where the payment was made"""
    country: NotRequired[str]
    r"""The country where the payment was made"""
    date_: NotRequired[date]
    r"""The date when the payment was made"""
    currency: NotRequired[str]
    r"""The currency of the payment"""
    total: NotRequired[float]
    r"""The total amount of the receipt"""
    phone: NotRequired[str]
    r"""The phone number of the organization that issued the receipt"""
    expense_type: NotRequired[ExpenseTypeTypedDict]
    r"""The type of the expense"""
    payment_method: NotRequired[str]
    r"""Payment method. Possible values: Card, Cash, Transfer, Mixed, Undefined"""
    card_type: NotRequired[str]
    r"""The payment processing network of the card used for payment. Possible values: Mastercard, VISA, AmericanExpress, NationalCard, Undefined"""
    card_number: NotRequired[str]
    r"""The number of the card used for payment. The number may be partially masked by replacing some digits with the X character"""
    tip: NotRequired[float]
    r"""The tip amount"""
    taxes: NotRequired[List[TaxesTypedDict]]
    r"""Tax details. No details will be shown if the Tax Rate and Tax Amount fields are empty. If multiple taxes have been detected, they will be displayed as multiple lines"""
    tax_total: NotRequired[float]
    r"""The total amount of tax levied on the purchase"""
    line_items: NotRequired[List[ReceiptLineItemTypedDict]]
    r"""The list of the purchased goods or services"""


class ReceiptFields(BaseModel):
    r"""Fields extracted from a receipt"""

    vendor: Optional[str] = None
    r"""The name of the organization that issued the receipt"""

    address: Optional[str] = None
    r"""The address of the organization that issued the receipt"""

    city: Optional[str] = None
    r"""The city where the payment was made"""

    country: Optional[str] = None
    r"""The country where the payment was made"""

    date_: Annotated[Optional[date], pydantic.Field(alias="date")] = None
    r"""The date when the payment was made"""

    currency: Optional[str] = None
    r"""The currency of the payment"""

    total: Optional[float] = None
    r"""The total amount of the receipt"""

    phone: Optional[str] = None
    r"""The phone number of the organization that issued the receipt"""

    expense_type: Annotated[
        Optional[ExpenseType], pydantic.Field(alias="expenseType")
    ] = None
    r"""The type of the expense"""

    payment_method: Annotated[Optional[str], pydantic.Field(alias="paymentMethod")] = (
        None
    )
    r"""Payment method. Possible values: Card, Cash, Transfer, Mixed, Undefined"""

    card_type: Annotated[Optional[str], pydantic.Field(alias="cardType")] = None
    r"""The payment processing network of the card used for payment. Possible values: Mastercard, VISA, AmericanExpress, NationalCard, Undefined"""

    card_number: Annotated[Optional[str], pydantic.Field(alias="cardNumber")] = None
    r"""The number of the card used for payment. The number may be partially masked by replacing some digits with the X character"""

    tip: Optional[float] = None
    r"""The tip amount"""

    taxes: Optional[List[Taxes]] = None
    r"""Tax details. No details will be shown if the Tax Rate and Tax Amount fields are empty. If multiple taxes have been detected, they will be displayed as multiple lines"""

    tax_total: Annotated[Optional[float], pydantic.Field(alias="taxTotal")] = None
    r"""The total amount of tax levied on the purchase"""

    line_items: Annotated[
        Optional[List[ReceiptLineItem]], pydantic.Field(alias="lineItems")
    ] = None
    r"""The list of the purchased goods or services"""
