# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias

from ..._utils import PropertyInfo
from ..._models import BaseModel

__all__ = ["ResponseApplyPatchToolCallOutput", "Caller", "CallerDirect", "CallerProgram"]


class CallerDirect(BaseModel):
    type: Literal["direct"]


class CallerProgram(BaseModel):
    caller_id: str
    """The call ID of the program item that produced this tool call."""

    type: Literal["program"]


Caller: TypeAlias = Annotated[Union[CallerDirect, CallerProgram, None], PropertyInfo(discriminator="type")]


class ResponseApplyPatchToolCallOutput(BaseModel):
    """The output emitted by an apply patch tool call."""

    id: str
    """The unique ID of the apply patch tool call output.

    Populated when this item is returned via API.
    """

    call_id: str
    """The unique ID of the apply patch tool call generated by the model."""

    status: Literal["completed", "failed"]
    """The status of the apply patch tool call output. One of `completed` or `failed`."""

    type: Literal["apply_patch_call_output"]
    """The type of the item. Always `apply_patch_call_output`."""

    caller: Optional[Caller] = None
    """The execution context that produced this tool call."""

    created_by: Optional[str] = None
    """The ID of the entity that created this tool call output."""

    output: Optional[str] = None
    """Optional textual output returned by the apply patch tool."""
