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

from __future__ import annotations
from .document import Document, DocumentTypedDict
from .receiptfields import ReceiptFields, ReceiptFieldsTypedDict
from abbyy_document_ai.types import BaseModel
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ValidationErrorsTypedDict(TypedDict):
    message: str


class ValidationErrors(BaseModel):
    message: str


class ReceiptTypedDict(TypedDict):
    r"""Extracted Receipt Data Response"""

    meta: DocumentTypedDict
    r"""Represents a document that has been submitted for processing."""
    fields: NotRequired[ReceiptFieldsTypedDict]
    r"""Fields extracted from a receipt"""
    validation_errors: NotRequired[List[ValidationErrorsTypedDict]]
    r"""An array of validation errors that occurred while processing the document. These typically do not prevent field extraction, but rather indicate issues extracting key fields."""


class Receipt(BaseModel):
    r"""Extracted Receipt Data Response"""

    meta: Document
    r"""Represents a document that has been submitted for processing."""

    fields: Optional[ReceiptFields] = None
    r"""Fields extracted from a receipt"""

    validation_errors: Annotated[
        Optional[List[ValidationErrors]], pydantic.Field(alias="validationErrors")
    ] = None
    r"""An array of validation errors that occurred while processing the document. These typically do not prevent field extraction, but rather indicate issues extracting key fields."""
