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

from __future__ import annotations
from .anthropicmessageresponse import (
    AnthropicMessageResponse,
    AnthropicMessageResponseTypedDict,
)
from .anthropicstreamevent import AnthropicStreamEvent, AnthropicStreamEventTypedDict
from r9s.types import BaseModel
from r9s.utils import eventstreaming
from typing import Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


class CreateMessageResponseBodyTypedDict(TypedDict):
    r"""Successful response"""

    data: AnthropicStreamEventTypedDict
    id: NotRequired[str]
    event: NotRequired[str]
    retry: NotRequired[int]


class CreateMessageResponseBody(BaseModel):
    r"""Successful response"""

    data: AnthropicStreamEvent

    id: Optional[str] = None

    event: Optional[str] = None

    retry: Optional[int] = None


CreateMessageResponseTypedDict = TypeAliasType(
    "CreateMessageResponseTypedDict",
    Union[
        AnthropicMessageResponseTypedDict,
        Union[
            eventstreaming.EventStream[AnthropicStreamEventTypedDict],
            eventstreaming.EventStreamAsync[AnthropicStreamEventTypedDict],
        ],
    ],
)


CreateMessageResponse = TypeAliasType(
    "CreateMessageResponse",
    Union[
        AnthropicMessageResponse,
        Union[
            eventstreaming.EventStream[AnthropicStreamEvent],
            eventstreaming.EventStreamAsync[AnthropicStreamEvent],
        ],
    ],
)
