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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .get_batch_root_response_results_item_status import GetBatchRootResponseResultsItemStatus


class GetBatchRootResponseResultsItem(UniversalBaseModel):
    batch_id: str = pydantic.Field()
    """
    The batch identifier. Use this to poll `/batch/{id}/progress` or fetch `/batch/{id}/results`.
    """

    status: GetBatchRootResponseResultsItemStatus = pydantic.Field()
    """
    `processing` while tasks are running; `completed` when all tasks have finished
    """

    progress: float = pydantic.Field()
    """
    Fraction of tasks completed (0.0 to 1.0)
    """

    tasks_count: int = pydantic.Field()
    """
    Total number of tasks in the batch
    """

    tasks_completed: int = pydantic.Field()
    """
    Number of tasks that completed successfully
    """

    tasks_failed: int = pydantic.Field()
    """
    Number of tasks that failed
    """

    modified_at: str = pydantic.Field()
    """
    Last time the batch was modified
    """

    completed_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    When the batch finished, or null if still processing
    """

    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
