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

from __future__ import annotations
from openrouter.types import BaseModel, UnrecognizedStr
from openrouter.utils import validate_const, validate_open_enum
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict


ChatMessageContentItemAudioFormat = Union[
    Literal[
        "wav",
        "mp3",
        "flac",
        "m4a",
        "ogg",
        "pcm16",
        "pcm24",
    ],
    UnrecognizedStr,
]


class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
    data: str
    format_: ChatMessageContentItemAudioFormat


class ChatMessageContentItemAudioInputAudio(BaseModel):
    data: str

    format_: Annotated[
        Annotated[
            ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
        ],
        pydantic.Field(alias="format"),
    ]


class ChatMessageContentItemAudioTypedDict(TypedDict):
    input_audio: ChatMessageContentItemAudioInputAudioTypedDict
    type: Literal["input_audio"]


class ChatMessageContentItemAudio(BaseModel):
    input_audio: ChatMessageContentItemAudioInputAudio

    TYPE: Annotated[
        Annotated[
            Literal["input_audio"], AfterValidator(validate_const("input_audio"))
        ],
        pydantic.Field(alias="type"),
    ] = "input_audio"
