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

from __future__ import annotations
from .jsonpatchpayloadresponse import (
    JSONPatchPayloadResponse,
    JSONPatchPayloadResponseTypedDict,
)
from .jsonpayloadresponse import JSONPayloadResponse, JSONPayloadResponseTypedDict
from functools import partial
from mistralai.client.types import BaseModel
from mistralai.client.utils.unions import parse_open_union
from pydantic import ConfigDict
from pydantic.functional_validators import BeforeValidator
from typing import Any, Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


PayloadTypedDict = TypeAliasType(
    "PayloadTypedDict",
    Union[JSONPayloadResponseTypedDict, JSONPatchPayloadResponseTypedDict],
)
r"""The current state or incremental update for the task."""


class UnknownPayload(BaseModel):
    r"""A Payload variant the SDK doesn't recognize. Preserves the raw payload."""

    type: Literal["UNKNOWN"] = "UNKNOWN"
    raw: Any
    is_unknown: Literal[True] = True

    model_config = ConfigDict(frozen=True)


_PAYLOAD_VARIANTS: dict[str, Any] = {
    "json": JSONPayloadResponse,
    "json_patch": JSONPatchPayloadResponse,
}


Payload = Annotated[
    Union[JSONPayloadResponse, JSONPatchPayloadResponse, UnknownPayload],
    BeforeValidator(
        partial(
            parse_open_union,
            disc_key="type",
            variants=_PAYLOAD_VARIANTS,
            unknown_cls=UnknownPayload,
            union_name="Payload",
        )
    ),
]
r"""The current state or incremental update for the task."""


class CustomTaskInProgressAttributesResponseTypedDict(TypedDict):
    r"""Attributes for custom task in-progress events with streaming updates."""

    custom_task_id: str
    r"""Unique identifier for the custom task within the workflow."""
    custom_task_type: str
    r"""The type/category of the custom task (e.g., 'llm_call', 'api_request')."""
    payload: PayloadTypedDict
    r"""The current state or incremental update for the task."""


class CustomTaskInProgressAttributesResponse(BaseModel):
    r"""Attributes for custom task in-progress events with streaming updates."""

    custom_task_id: str
    r"""Unique identifier for the custom task within the workflow."""

    custom_task_type: str
    r"""The type/category of the custom task (e.g., 'llm_call', 'api_request')."""

    payload: Payload
    r"""The current state or incremental update for the task."""
