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

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


class Status(str, Enum):
    r"""The status of the document. Valid values are `Pending`, `Processing`, `Processed`, `Failed`, `Canceled`."""

    PENDING = "Pending"
    PROCESSING = "Processing"
    PROCESSED = "Processed"
    FAILED = "Failed"
    CANCELED = "Canceled"


class ErrorsTypedDict(TypedDict):
    message: str


class Errors(BaseModel):
    message: str


class DocumentTypedDict(TypedDict):
    r"""Represents a document that has been submitted for processing."""

    id: str
    r"""The id of the document."""
    name: str
    r"""The name of the document."""
    created_at: datetime
    r"""Timestamp at which the document was created."""
    status: Status
    r"""The status of the document. Valid values are `Pending`, `Processing`, `Processed`, `Failed`, `Canceled`."""
    page_count: int
    r"""The number of pages associated with the document that have been processed. This number will always be at least 1."""
    model: NotRequired[str]
    r"""The model used to process the document."""
    errors: NotRequired[List[ErrorsTypedDict]]
    r"""An array of errors that occurred while processing the document."""


class Document(BaseModel):
    r"""Represents a document that has been submitted for processing."""

    id: str
    r"""The id of the document."""

    name: str
    r"""The name of the document."""

    created_at: Annotated[datetime, pydantic.Field(alias="createdAt")]
    r"""Timestamp at which the document was created."""

    status: Status
    r"""The status of the document. Valid values are `Pending`, `Processing`, `Processed`, `Failed`, `Canceled`."""

    page_count: Annotated[int, pydantic.Field(alias="pageCount")]
    r"""The number of pages associated with the document that have been processed. This number will always be at least 1."""

    model: Optional[str] = None
    r"""The model used to process the document."""

    errors: Optional[List[Errors]] = None
    r"""An array of errors that occurred while processing the document."""
