"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 4d485091a76e

from __future__ import annotations
from .jsonpatchadd import JSONPatchAdd, JSONPatchAddTypedDict
from .jsonpatchappend import JSONPatchAppend, JSONPatchAppendTypedDict
from .jsonpatchremove import JSONPatchRemove, JSONPatchRemoveTypedDict
from .jsonpatchreplace import JSONPatchReplace, JSONPatchReplaceTypedDict
from mistralai.workflows.worker_client.types import BaseModel
from mistralai.workflows.worker_client.utils import validate_const
import pydantic
from pydantic import Field
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


ValueTypedDict = TypeAliasType(
    "ValueTypedDict",
    Union[
        JSONPatchAppendTypedDict,
        JSONPatchAddTypedDict,
        JSONPatchReplaceTypedDict,
        JSONPatchRemoveTypedDict,
    ],
)


Value = Annotated[
    Union[JSONPatchAdd, JSONPatchAppend, JSONPatchRemove, JSONPatchReplace],
    Field(discriminator="op"),
]


class JSONPatchPayloadInputTypedDict(TypedDict):
    r"""A payload containing a list of JSON Patch operations.

    Used for streaming incremental updates to workflow state.
    """

    value: List[ValueTypedDict]
    r"""The list of JSON Patch operations to apply in order."""
    type: Literal["json_patch"]
    r"""Discriminator indicating this is a JSON Patch payload."""


class JSONPatchPayloadInput(BaseModel):
    r"""A payload containing a list of JSON Patch operations.

    Used for streaming incremental updates to workflow state.
    """

    value: List[Value]
    r"""The list of JSON Patch operations to apply in order."""

    type: Annotated[
        Annotated[Literal["json_patch"], AfterValidator(validate_const("json_patch"))],
        pydantic.Field(alias="type"),
    ] = "json_patch"
    r"""Discriminator indicating this is a JSON Patch payload."""


try:
    JSONPatchPayloadInput.model_rebuild()
except NameError:
    pass
