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

from __future__ import annotations
from openrouter.components import (
    openresponsesnonstreamingresponse as components_openresponsesnonstreamingresponse,
    openresponsesrequest as components_openresponsesrequest,
    openresponsesstreamevent as components_openresponsesstreamevent,
)
from openrouter.types import BaseModel
from openrouter.utils import (
    FieldMetadata,
    HeaderMetadata,
    RequestMetadata,
    eventstreaming,
)
import pydantic
from typing import Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


class CreateResponsesGlobalsTypedDict(TypedDict):
    http_referer: NotRequired[str]
    r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
    This is used to track API usage per application.

    """
    x_title: NotRequired[str]
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """


class CreateResponsesGlobals(BaseModel):
    http_referer: Annotated[
        Optional[str],
        pydantic.Field(alias="HTTP-Referer"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
    This is used to track API usage per application.

    """

    x_title: Annotated[
        Optional[str],
        pydantic.Field(alias="X-Title"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """


class CreateResponsesRequestTypedDict(TypedDict):
    open_responses_request: (
        components_openresponsesrequest.OpenResponsesRequestTypedDict
    )
    http_referer: NotRequired[str]
    r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
    This is used to track API usage per application.

    """
    x_title: NotRequired[str]
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """


class CreateResponsesRequest(BaseModel):
    open_responses_request: Annotated[
        components_openresponsesrequest.OpenResponsesRequest,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]

    http_referer: Annotated[
        Optional[str],
        pydantic.Field(alias="HTTP-Referer"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
    This is used to track API usage per application.

    """

    x_title: Annotated[
        Optional[str],
        pydantic.Field(alias="X-Title"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """


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

    data: components_openresponsesstreamevent.OpenResponsesStreamEventTypedDict
    r"""Union of all possible event types emitted during response streaming"""


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

    data: components_openresponsesstreamevent.OpenResponsesStreamEvent
    r"""Union of all possible event types emitted during response streaming"""


CreateResponsesResponseTypedDict = TypeAliasType(
    "CreateResponsesResponseTypedDict",
    Union[
        components_openresponsesnonstreamingresponse.OpenResponsesNonStreamingResponseTypedDict,
        Union[
            eventstreaming.EventStream[
                components_openresponsesstreamevent.OpenResponsesStreamEventTypedDict
            ],
            eventstreaming.EventStreamAsync[
                components_openresponsesstreamevent.OpenResponsesStreamEventTypedDict
            ],
        ],
    ],
)


CreateResponsesResponse = TypeAliasType(
    "CreateResponsesResponse",
    Union[
        components_openresponsesnonstreamingresponse.OpenResponsesNonStreamingResponse,
        Union[
            eventstreaming.EventStream[
                components_openresponsesstreamevent.OpenResponsesStreamEvent
            ],
            eventstreaming.EventStreamAsync[
                components_openresponsesstreamevent.OpenResponsesStreamEvent
            ],
        ],
    ],
)
