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

from __future__ import annotations
from .inputsource import InputSource, InputSourceTypedDict
from abbyy_document_ai.types import BaseModel
from enum import Enum
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class BeginImageToTextTextExtractionRequestBodyLanguages(str, Enum):
    r"""The ISO 639-1 codes for the languages contained within the input source(s). If not provided, the default is English, French, German, and Spanish (en|fr|de|es)."""

    EN_FR_DE_ES = "en|fr|de|es"
    EN = "en"
    EN_ES = "en|es"
    EN_FR = "en|fr"
    EN_FR_NL = "en|fr|nl"
    EN_DE = "en|de"
    EN_JA = "en|ja"
    EN_ZH = "en|zh"


class BeginImageToTextTextExtractionRequestBodyOptionsTypedDict(TypedDict):
    preserve_document_structure: NotRequired[bool]
    r"""Set to true to enable structured output mode. This mode is focused on retaining the original document structure and appearance, including font styles, pictures, background color, etc., and is more focused on documents like agreements, contracts, specifications. If this option is set to false or not specified, text-only mode is used. Text-only mode is suitable for extracting all text from the input image, including small text areas of low quality. The document appearance and structure are ignored, pictures and tables are not detected. It is designed for the situations when you need to retrieve the data from the image for some further processing on your side, such as extracting data from bills, receipts or invoices."""
    languages: NotRequired[BeginImageToTextTextExtractionRequestBodyLanguages]
    r"""The ISO 639-1 codes for the languages contained within the input source(s). If not provided, the default is English, French, German, and Spanish (en|fr|de|es)."""
    handwriting: NotRequired[bool]
    r"""Whether the input source(s) contain handwriting. Defaults to false."""


class BeginImageToTextTextExtractionRequestBodyOptions(BaseModel):
    preserve_document_structure: Annotated[
        Optional[bool], pydantic.Field(alias="preserveDocumentStructure")
    ] = None
    r"""Set to true to enable structured output mode. This mode is focused on retaining the original document structure and appearance, including font styles, pictures, background color, etc., and is more focused on documents like agreements, contracts, specifications. If this option is set to false or not specified, text-only mode is used. Text-only mode is suitable for extracting all text from the input image, including small text areas of low quality. The document appearance and structure are ignored, pictures and tables are not detected. It is designed for the situations when you need to retrieve the data from the image for some further processing on your side, such as extracting data from bills, receipts or invoices."""

    languages: Optional[BeginImageToTextTextExtractionRequestBodyLanguages] = None
    r"""The ISO 639-1 codes for the languages contained within the input source(s). If not provided, the default is English, French, German, and Spanish (en|fr|de|es)."""

    handwriting: Optional[bool] = None
    r"""Whether the input source(s) contain handwriting. Defaults to false."""


class BeginImageToTextTextExtractionRequestBodyTypedDict(TypedDict):
    r"""Request to process a document using the image-to-text model"""

    input_source: InputSourceTypedDict
    r"""The source of the document(s) to be processed"""
    options: NotRequired[BeginImageToTextTextExtractionRequestBodyOptionsTypedDict]


class BeginImageToTextTextExtractionRequestBody(BaseModel):
    r"""Request to process a document using the image-to-text model"""

    input_source: Annotated[InputSource, pydantic.Field(alias="inputSource")]
    r"""The source of the document(s) to be processed"""

    options: Optional[BeginImageToTextTextExtractionRequestBodyOptions] = None
