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

from __future__ import annotations
from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
from .textchunk import TextChunk, TextChunkTypedDict
from mistralai.types import BaseModel
from mistralai.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


ThinkingTypedDict = TypeAliasType(
    "ThinkingTypedDict", Union[ReferenceChunkTypedDict, TextChunkTypedDict]
)


Thinking = TypeAliasType("Thinking", Union[ReferenceChunk, TextChunk])


class ThinkChunkTypedDict(TypedDict):
    thinking: List[ThinkingTypedDict]
    type: Literal["thinking"]
    closed: NotRequired[bool]
    r"""Whether the thinking chunk is closed or not. Currently only used for prefixing."""


class ThinkChunk(BaseModel):
    thinking: List[Thinking]

    type: Annotated[
        Annotated[
            Optional[Literal["thinking"]], AfterValidator(validate_const("thinking"))
        ],
        pydantic.Field(alias="type"),
    ] = "thinking"

    closed: Optional[bool] = None
    r"""Whether the thinking chunk is closed or not. Currently only used for prefixing."""
