# generated by datamodel-codegen:
#   filename:  v1.yaml
#   timestamp: 2025-01-30T17:10:59+00:00

from __future__ import annotations

from typing import Dict, Optional

from pydantic import BaseModel, Field


class Error(BaseModel):
    message: str = Field(..., description="The error message.")


class SandboxSpec(BaseModel):
    image: Optional[str] = Field(
        None, description="The container image the sandbox will run with."
    )
    env: Optional[Dict[str, str]] = Field(
        None, description="Environment variables for the sandbox."
    )


class SandboxStatus(BaseModel):
    pass


class RunIPythonCellRequest(BaseModel):
    code: str = Field(..., description="The code to run in the IPython kernel.")
    split_output: Optional[bool] = Field(
        False,
        description="Set to true to split the output into stdout and stderr. If set, the output field in the response will be empty and the stdout and stderr fields will be populated.",
    )


class RunIPythonCellResult(BaseModel):
    output: Optional[str] = Field(
        None, description="The stdout and stderr from the IPython kernel interleaved."
    )
    stdout: Optional[str] = Field(
        None, description="The stdout from the IPython kernel."
    )
    stderr: Optional[str] = Field(
        None, description="The stderr from the IPython kernel."
    )


class RunShellCommandRequest(BaseModel):
    command: str = Field(..., description="The command to execute.")
    split_output: Optional[bool] = Field(
        False,
        description="Set to true to split the output into stdout and stderr. If set, the output field in the response will be empty and the stdout and stderr fields will be populated.",
    )


class RunShellCommandResult(BaseModel):
    output: Optional[str] = Field(
        None, description="The stdout and stderr from the shell command."
    )
    stdout: Optional[str] = Field(None, description="The stdout from the shell command")
    stderr: Optional[str] = Field(
        None, description="The stderr from the shell command."
    )


class CreateSandboxRequest(BaseModel):
    name: Optional[str] = Field(
        None,
        description="The name of the sandbox. If not specified, will be generated automatically.",
    )
    spec: SandboxSpec


class Sandbox(BaseModel):
    name: Optional[str] = Field(None, description="The name of the sandbox.")
    uid: Optional[str] = Field(
        None,
        description="An identifier that is unique to the instance (in time) of the sandbox.",
    )
    spec: SandboxSpec
    status: Optional[SandboxStatus] = None
