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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .training_custom_model import TrainingCustomModel


class StateTraining_Queued(UniversalBaseModel):
    status: typing.Literal["QUEUED"] = "QUEUED"
    created_timestamp_ms: int

    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


class StateTraining_InProgress(UniversalBaseModel):
    status: typing.Literal["IN_PROGRESS"] = "IN_PROGRESS"
    created_timestamp_ms: int
    started_timestamp_ms: int

    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


class StateTraining_Completed(UniversalBaseModel):
    status: typing.Literal["COMPLETED"] = "COMPLETED"
    created_timestamp_ms: int
    started_timestamp_ms: int
    ended_timestamp_ms: int
    custom_model: TrainingCustomModel
    alternatives: typing.Optional[typing.Dict[str, TrainingCustomModel]] = None

    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


class StateTraining_Failed(UniversalBaseModel):
    status: typing.Literal["FAILED"] = "FAILED"
    created_timestamp_ms: int
    started_timestamp_ms: int
    ended_timestamp_ms: int
    message: str

    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


StateTraining = typing_extensions.Annotated[
    typing.Union[StateTraining_Queued, StateTraining_InProgress, StateTraining_Completed, StateTraining_Failed],
    pydantic.Field(discriminator="status"),
]
