"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .codeinterpreteroutputlogs import (
    CodeInterpreterOutputLogs,
    CodeInterpreterOutputLogsTypedDict,
)
from enum import Enum
import pydantic
from pydantic.functional_validators import AfterValidator
from ragie.types import BaseModel
from ragie.utils import validate_const
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class CodeInterpreterOutputStatus(str, Enum):
    IN_PROGRESS = "in_progress"
    INTERPRETING = "interpreting"
    COMPLETED = "completed"
    INCOMPLETE = "incomplete"
    FAILED = "failed"


class CodeInterpreterOutputTypedDict(TypedDict):
    id: str
    r"""The unique ID of the code interpreter tool call."""
    code: str
    r"""The code executed by the code interpreter."""
    container_id: str
    r"""The ID of the container used to run the code."""
    outputs: List[CodeInterpreterOutputLogsTypedDict]
    r"""The outputs generated by the code interpreter, such as logs or images."""
    type: Literal["code_interpreter_output"]
    status: NotRequired[CodeInterpreterOutputStatus]


class CodeInterpreterOutput(BaseModel):
    id: str
    r"""The unique ID of the code interpreter tool call."""

    code: str
    r"""The code executed by the code interpreter."""

    container_id: str
    r"""The ID of the container used to run the code."""

    outputs: List[CodeInterpreterOutputLogs]
    r"""The outputs generated by the code interpreter, such as logs or images."""

    TYPE: Annotated[
        Annotated[
            Optional[Literal["code_interpreter_output"]],
            AfterValidator(validate_const("code_interpreter_output")),
        ],
        pydantic.Field(alias="type"),
    ] = "code_interpreter_output"

    status: Optional[CodeInterpreterOutputStatus] = (
        CodeInterpreterOutputStatus.COMPLETED
    )
