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

from __future__ import annotations
from .applypatchcreatefileoperation import (
    ApplyPatchCreateFileOperation,
    ApplyPatchCreateFileOperationTypedDict,
)
from .applypatchdeletefileoperation import (
    ApplyPatchDeleteFileOperation,
    ApplyPatchDeleteFileOperationTypedDict,
)
from .applypatchupdatefileoperation import (
    ApplyPatchUpdateFileOperation,
    ApplyPatchUpdateFileOperationTypedDict,
)
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


ApplyPatchCallOperationTypedDict = TypeAliasType(
    "ApplyPatchCallOperationTypedDict",
    Union[
        ApplyPatchDeleteFileOperationTypedDict,
        ApplyPatchCreateFileOperationTypedDict,
        ApplyPatchUpdateFileOperationTypedDict,
    ],
)
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""


ApplyPatchCallOperation = Annotated[
    Union[
        Annotated[ApplyPatchCreateFileOperation, Tag("create_file")],
        Annotated[ApplyPatchDeleteFileOperation, Tag("delete_file")],
        Annotated[ApplyPatchUpdateFileOperation, Tag("update_file")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
r"""The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it."""
