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

from __future__ import annotations
from .anthropiccontentblockdelta import (
    AnthropicContentBlockDelta,
    AnthropicContentBlockDeltaTypedDict,
)
from .anthropiccontentblockstart import (
    AnthropicContentBlockStart,
    AnthropicContentBlockStartTypedDict,
)
from .anthropiccontentblockstop import (
    AnthropicContentBlockStop,
    AnthropicContentBlockStopTypedDict,
)
from .anthropicmessagedelta import AnthropicMessageDelta, AnthropicMessageDeltaTypedDict
from .anthropicmessagestart import AnthropicMessageStart, AnthropicMessageStartTypedDict
from .anthropicping import AnthropicPing, AnthropicPingTypedDict
from .anthropicstreammessagestop import (
    AnthropicStreamMessageStop,
    AnthropicStreamMessageStopTypedDict,
)
from pydantic import Discriminator, Tag
from r9s.utils import get_discriminator
from typing import Union
from typing_extensions import Annotated, TypeAliasType


AnthropicStreamEventTypedDict = TypeAliasType(
    "AnthropicStreamEventTypedDict",
    Union[
        AnthropicStreamMessageStopTypedDict,
        AnthropicPingTypedDict,
        AnthropicMessageStartTypedDict,
        AnthropicContentBlockStartTypedDict,
        AnthropicContentBlockDeltaTypedDict,
        AnthropicContentBlockStopTypedDict,
        AnthropicMessageDeltaTypedDict,
    ],
)


AnthropicStreamEvent = Annotated[
    Union[
        Annotated[AnthropicMessageStart, Tag("message_start")],
        Annotated[AnthropicContentBlockStart, Tag("content_block_start")],
        Annotated[AnthropicContentBlockDelta, Tag("content_block_delta")],
        Annotated[AnthropicContentBlockStop, Tag("content_block_stop")],
        Annotated[AnthropicMessageDelta, Tag("message_delta")],
        Annotated[AnthropicStreamMessageStop, Tag("message_stop")],
        Annotated[AnthropicPing, Tag("ping")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
