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

from __future__ import annotations
from .applypatchcalloperation import (
    ApplyPatchCallOperation,
    ApplyPatchCallOperationTypedDict,
)
from .toolcallstatus import ToolCallStatus
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


OutputApplyPatchServerToolItemType = Literal["openrouter:apply_patch",]


class OutputApplyPatchServerToolItemTypedDict(TypedDict):
    r"""An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn."""

    status: ToolCallStatus
    type: OutputApplyPatchServerToolItemType
    call_id: NotRequired[str]
    id: NotRequired[str]
    operation: NotRequired[ApplyPatchCallOperationTypedDict]
    r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""


class OutputApplyPatchServerToolItem(BaseModel):
    r"""An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn."""

    status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))]

    type: OutputApplyPatchServerToolItemType

    call_id: Optional[str] = None

    id: Optional[str] = None

    operation: Optional[ApplyPatchCallOperation] = None
    r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
