# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .batch_run_entity import BatchRunEntity
from .batch_run_entity_version import BatchRunEntityVersion
from .batch_run_metrics import BatchRunMetrics
from .batch_run_status import BatchRunStatus
from .created_at import CreatedAt
from .updated_at import UpdatedAt


class BatchRun(UncheckedBaseModel):
    object: typing.Literal["batch_run"] = pydantic.Field(default="batch_run")
    """
    The type of object. In this case, it will always be `"batch_run"`.
    """

    id: str = pydantic.Field()
    """
    The unique identifier for this batch run.
    
    Example: `"batch_run_Xj8mK2pL9nR4vT7qY5wZ"`
    """

    entity: typing.Optional[BatchRunEntity] = pydantic.Field(default=None)
    """
    The extractor, classifier, or splitter that was run.
    
    **Availability:** Present when an entity was provided when creating the batch run.
    """

    entity_version: typing_extensions.Annotated[
        typing.Optional[BatchRunEntityVersion], FieldMetadata(alias="entityVersion")
    ] = pydantic.Field(alias="entityVersion", default=None)
    """
    The version of the extractor, classifier, or splitter that was run.
    
    **Availability:** Present when an entity was provided when creating the batch run.
    """

    status: BatchRunStatus
    metrics: BatchRunMetrics
    created_at: typing_extensions.Annotated[CreatedAt, FieldMetadata(alias="createdAt")] = pydantic.Field(
        alias="createdAt"
    )
    updated_at: typing_extensions.Annotated[UpdatedAt, FieldMetadata(alias="updatedAt")] = pydantic.Field(
        alias="updatedAt"
    )

    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
