# 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 .command_status import CommandStatus


class BashExecResult(UniversalBaseModel):
    """
    Result of exec_command — returned by POST /v1/bash/exec.
    """

    session_id: str = pydantic.Field()
    """
    Session identifier
    """

    command_id: str = pydantic.Field()
    """
    Unique command identifier
    """

    command: str = pydantic.Field()
    """
    The executed command
    """

    status: CommandStatus = pydantic.Field()
    """
    Command status
    """

    stdout: typing.Optional[str] = pydantic.Field(default=None)
    """
    Stdout output up to this point
    """

    stderr: typing.Optional[str] = pydantic.Field(default=None)
    """
    Stderr output up to this point
    """

    exit_code: typing.Optional[int] = pydantic.Field(default=None)
    """
    Exit code (when completed)
    """

    offset: typing.Optional[int] = pydantic.Field(default=None)
    """
    Current stdout offset for subsequent /output calls
    """

    stderr_offset: typing.Optional[int] = pydantic.Field(default=None)
    """
    Current stderr offset
    """

    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
