# 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 .created_at import CreatedAt
from .file_summary import FileSummary
from .processor_run_status import ProcessorRunStatus
from .run_metadata import RunMetadata
from .run_usage import RunUsage
from .splitter_summary import SplitterSummary
from .splitter_version_summary import SplitterVersionSummary
from .updated_at import UpdatedAt


class SplitRunSummary(UncheckedBaseModel):
    """
    Summary representation of a split run.
    """

    object: typing.Literal["split_run"] = pydantic.Field(default="split_run")
    """
    The type of object. Will always be `"split_run"`.
    """

    id: str = pydantic.Field()
    """
    The unique identifier for this split run.
    """

    splitter: typing.Optional[SplitterSummary] = pydantic.Field(default=None)
    """
    The splitter that was used for this run.
    
    **Availability:** Present when a splitter reference was provided. Not present when using inline `config`.
    """

    splitter_version: typing_extensions.Annotated[
        typing.Optional[SplitterVersionSummary], FieldMetadata(alias="splitterVersion")
    ] = pydantic.Field(alias="splitterVersion", default=None)
    """
    The version of the splitter that was used for this run.
    
    **Availability:** Present when a splitter reference was provided. Not present when using inline `config`.
    """

    status: ProcessorRunStatus
    failure_reason: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="failureReason")] = (
        pydantic.Field(alias="failureReason", default=None)
    )
    """
    The reason for failure.
    
    **Availability:** Present when `status` is `"FAILED"`.
    """

    failure_message: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="failureMessage")] = (
        pydantic.Field(alias="failureMessage", default=None)
    )
    """
    A detailed message about the failure.
    
    **Availability:** Present when `status` is `"FAILED"`.
    """

    metadata: typing.Optional[RunMetadata] = pydantic.Field(default=None)
    """
    Any metadata that was provided when creating the split run.
    
    **Availability:** Present when metadata was provided during creation.
    """

    reviewed: bool = pydantic.Field()
    """
    Indicates whether the run has been reviewed by a human.
    """

    edited: bool = pydantic.Field()
    """
    Indicates whether the run results have been edited during review.
    """

    file: FileSummary = pydantic.Field()
    """
    The file that was processed.
    """

    parse_run_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="parseRunId")] = pydantic.Field(
        alias="parseRunId", default=None
    )
    """
    The ID of the parse run that was used for this split run.
    
    **Availability:** Present when a parse run was created.
    """

    dashboard_url: typing_extensions.Annotated[str, FieldMetadata(alias="dashboardUrl")] = pydantic.Field(
        alias="dashboardUrl"
    )
    """
    The URL to view the split run in the Extend dashboard.
    """

    usage: typing.Optional[RunUsage] = pydantic.Field(default=None)
    """
    Usage credits consumed by this run.
    
    **Availability:** Present when `status` is `"PROCESSED"`.
    """

    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
