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

from __future__ import annotations
from .provideroptions import ProviderOptions, ProviderOptionsTypedDict
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


class SpeechRequestProviderTypedDict(TypedDict):
    r"""Provider-specific passthrough configuration"""

    options: NotRequired[ProviderOptionsTypedDict]
    r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""


class SpeechRequestProvider(BaseModel):
    r"""Provider-specific passthrough configuration"""

    options: Optional[ProviderOptions] = None
    r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""


ResponseFormatEnum = Union[
    Literal[
        "mp3",
        "pcm",
    ],
    UnrecognizedStr,
]
r"""Audio output format"""


class SpeechRequestTypedDict(TypedDict):
    r"""Text-to-speech request input"""

    input: str
    r"""Text to synthesize"""
    model: str
    r"""TTS model identifier"""
    voice: str
    r"""Voice identifier (provider-specific)."""
    provider: NotRequired[SpeechRequestProviderTypedDict]
    r"""Provider-specific passthrough configuration"""
    response_format: NotRequired[ResponseFormatEnum]
    r"""Audio output format"""
    speed: NotRequired[float]
    r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers."""


class SpeechRequest(BaseModel):
    r"""Text-to-speech request input"""

    input: str
    r"""Text to synthesize"""

    model: str
    r"""TTS model identifier"""

    voice: str
    r"""Voice identifier (provider-specific)."""

    provider: Optional[SpeechRequestProvider] = None
    r"""Provider-specific passthrough configuration"""

    response_format: Annotated[
        Optional[ResponseFormatEnum], PlainValidator(validate_open_enum(False))
    ] = "pcm"
    r"""Audio output format"""

    speed: Optional[float] = None
    r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers."""
