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

from __future__ import annotations
from .responseobject import ResponseObject, ResponseObjectTypedDict
from .responsestreamevent import ResponseStreamEvent, ResponseStreamEventTypedDict
from r9s.types import BaseModel
from r9s.utils import eventstreaming
from typing import Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


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

    data: ResponseStreamEventTypedDict
    r"""Response stream event (data payload for SSE stream)"""
    id: NotRequired[str]
    event: NotRequired[str]
    retry: NotRequired[int]


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

    data: ResponseStreamEvent
    r"""Response stream event (data payload for SSE stream)"""

    id: Optional[str] = None

    event: Optional[str] = None

    retry: Optional[int] = None


CreateResponseResponseTypedDict = TypeAliasType(
    "CreateResponseResponseTypedDict",
    Union[
        ResponseObjectTypedDict,
        Union[
            eventstreaming.EventStream[ResponseStreamEventTypedDict],
            eventstreaming.EventStreamAsync[ResponseStreamEventTypedDict],
        ],
    ],
)


CreateResponseResponse = TypeAliasType(
    "CreateResponseResponse",
    Union[
        ResponseObject,
        Union[
            eventstreaming.EventStream[ResponseStreamEvent],
            eventstreaming.EventStreamAsync[ResponseStreamEvent],
        ],
    ],
)
