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

from __future__ import annotations
from openrouter.components import (
    openresponsesresult as components_openresponsesresult,
    responsesrequest as components_responsesrequest,
    streamevents as components_streamevents,
)
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_open_router_title: NotRequired[str]
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """
    x_open_router_categories: NotRequired[str]
    r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.

    """


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_open_router_title: Annotated[
        Optional[str],
        pydantic.Field(alias="X-OpenRouter-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.

    """

    x_open_router_categories: Annotated[
        Optional[str],
        pydantic.Field(alias="X-OpenRouter-Categories"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.

    """


class CreateResponsesRequestTypedDict(TypedDict):
    responses_request: components_responsesrequest.ResponsesRequestTypedDict
    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_open_router_title: NotRequired[str]
    r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.

    """
    x_open_router_categories: NotRequired[str]
    r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.

    """


class CreateResponsesRequest(BaseModel):
    responses_request: Annotated[
        components_responsesrequest.ResponsesRequest,
        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_open_router_title: Annotated[
        Optional[str],
        pydantic.Field(alias="X-OpenRouter-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.

    """

    x_open_router_categories: Annotated[
        Optional[str],
        pydantic.Field(alias="X-OpenRouter-Categories"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.

    """


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

    data: components_streamevents.StreamEventsTypedDict
    r"""Union of all possible event types emitted during response streaming"""


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

    data: components_streamevents.StreamEvents
    r"""Union of all possible event types emitted during response streaming"""


CreateResponsesResponseTypedDict = TypeAliasType(
    "CreateResponsesResponseTypedDict",
    Union[
        components_openresponsesresult.OpenResponsesResultTypedDict,
        Union[
            eventstreaming.EventStream[components_streamevents.StreamEventsTypedDict],
            eventstreaming.EventStreamAsync[
                components_streamevents.StreamEventsTypedDict
            ],
        ],
    ],
)


CreateResponsesResponse = TypeAliasType(
    "CreateResponsesResponse",
    Union[
        components_openresponsesresult.OpenResponsesResult,
        Union[
            eventstreaming.EventStream[components_streamevents.StreamEvents],
            eventstreaming.EventStreamAsync[components_streamevents.StreamEvents],
        ],
    ],
)
