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

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.client.types import BaseModel
from mistralai.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


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


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


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

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

    value: List[JSONPatchPayloadRequestValueTypedDict]
    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 JSONPatchPayloadRequest(BaseModel):
    r"""A payload containing a list of JSON Patch operations.

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

    value: List[JSONPatchPayloadRequestValue]
    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:
    JSONPatchPayloadRequest.model_rebuild()
except NameError:
    pass
