# 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 .confidence_metrics import ConfidenceMetrics


class DocumentExtractResponse(UniversalBaseModel):
    """
    Response model for document extraction.
    """

    success: bool = pydantic.Field()
    """
    Whether the request was successful
    """

    job_id: str = pydantic.Field()
    """
    Job ID for tracking
    """

    status: str = pydantic.Field()
    """
    Job status (pending, processing, completed, failed)
    """

    extracted_data: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Extracted data (if completed)
    """

    explanation: typing.Optional[str] = pydantic.Field(default=None)
    """
    LLM explanation of the extraction
    """

    confidence: typing.Optional[ConfidenceMetrics] = pydantic.Field(default=None)
    """
    Extraction confidence metrics
    """

    processing_time: typing.Optional[float] = pydantic.Field(default=None)
    """
    Processing time in seconds
    """

    model_used: typing.Optional[str] = pydantic.Field(default=None)
    """
    Model used for extraction
    """

    created_at: dt.datetime = pydantic.Field()
    """
    Job creation timestamp
    """

    completed_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Job completion timestamp
    """

    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
