# File generated from our OpenAPI spec by Castiron. 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__ = ["BetaResponseApplyPatchToolCallOutput", "Agent", "Caller", "CallerDirect", "CallerProgram"]


class Agent(BaseModel):
    """The agent that produced this item."""

    agent_name: str
    """The canonical name of the agent that produced this item."""


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 BetaResponseApplyPatchToolCallOutput(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`."""

    agent: Optional[Agent] = None
    """The agent that produced this item."""

    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."""
