"""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


AnthropicContentBlockStartType = Literal[
    "text",
    "tool_use",
]


class AnthropicContentBlockStartInputTypedDict(TypedDict):
    pass


class AnthropicContentBlockStartInput(BaseModel):
    pass


class ContentBlockTypedDict(TypedDict):
    type: AnthropicContentBlockStartType
    text: NotRequired[str]
    id: NotRequired[str]
    name: NotRequired[str]
    input: NotRequired[AnthropicContentBlockStartInputTypedDict]


class ContentBlock(BaseModel):
    type: AnthropicContentBlockStartType

    text: Optional[str] = None

    id: Optional[str] = None

    name: Optional[str] = None

    input: Optional[AnthropicContentBlockStartInput] = None


class AnthropicContentBlockStartTypedDict(TypedDict):
    index: int
    content_block: ContentBlockTypedDict
    type: Literal["content_block_start"]


class AnthropicContentBlockStart(BaseModel):
    index: int

    content_block: ContentBlock

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