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

from __future__ import annotations
import pydantic
from pydantic.functional_validators import AfterValidator
from r9s.types import BaseModel
from r9s.utils import validate_const
from typing import Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


AnthropicContentBlockDeltaType = Literal[
    "text_delta",
    "input_json_delta",
]


class AnthropicContentBlockDeltaDeltaTypedDict(TypedDict):
    type: NotRequired[AnthropicContentBlockDeltaType]
    text: NotRequired[str]
    partial_json: NotRequired[str]


class AnthropicContentBlockDeltaDelta(BaseModel):
    type: Optional[AnthropicContentBlockDeltaType] = None

    text: Optional[str] = None

    partial_json: Optional[str] = None


class AnthropicContentBlockDeltaTypedDict(TypedDict):
    index: int
    delta: AnthropicContentBlockDeltaDeltaTypedDict
    type: Literal["content_block_delta"]


class AnthropicContentBlockDelta(BaseModel):
    index: int

    delta: AnthropicContentBlockDeltaDelta

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