# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# pyformat: disable
# pylint: skip-file

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

from __future__ import annotations
from ..types import BaseModel, UNSET_SENTINEL
from ..utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ListVoicesGlobalsTypedDict(TypedDict):
    api_version: NotRequired[str]
    r"""API version for request routing."""


class ListVoicesGlobals(BaseModel):
    api_version: Annotated[
        Optional[str],
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ] = None
    r"""API version for request routing."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["api_version"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class ListVoicesRequestParam(TypedDict):
    api_version: NotRequired[str]
    r"""API version for request routing."""
    accent: NotRequired[List[str]]
    r"""Optional. Filter by accent description (e.g. \"American\", \"British\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified accents (OR).
    """
    contexts: NotRequired[List[str]]
    r"""Optional. Filter by intended context or domain (e.g. \"News, Commercial\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified contexts (OR).
    """
    gender: NotRequired[List[str]]
    r"""Optional. Filter by gender presentation (e.g. \"female\", \"male\", \"neutral\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified genders (OR).
    """
    language_code: NotRequired[List[str]]
    r"""Optional. Filter by BCP-47 language code (e.g. \"en-US\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified language codes (OR).
    """
    page_size: NotRequired[int]
    r"""Optional. The maximum number of voices to return per page. The service may
    return fewer than this value. If unspecified, at most 50 voices are
    returned. The maximum value is 1000; values above 1000 are coerced to
    1000.
    """
    page_token: NotRequired[str]
    r"""Optional. A page token received from a previous `ListVoices` call. Provide
    this to retrieve the subsequent page.

    When paginating, all filter query parameters (`language_code`,
    `region_code`, `accent`, `persona`, `context`, `gender`, `pitch`, `type`,
    and `search`) must match the call that returned this token; otherwise the
    request fails with `INVALID_ARGUMENT`. `page_size` may change between
    pages.
    """
    persona: NotRequired[List[str]]
    r"""Optional. Filter by vocal persona (e.g. \"Warm, Friendly\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified personas (OR).
    """
    pitch: NotRequired[List[str]]
    r"""Optional. Filter by vocal pitch. Accepts `\"low\"`, `\"medium\"`, `\"high\"`
    (case-insensitive). If multiple values are specified, matches voices with
    any of the specified pitches (OR).
    """
    region_code: NotRequired[List[str]]
    r"""Optional. Filter by ISO 3166-1 alpha-2 or UN M.49 region code (e.g. \"US\",
    \"001\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified region codes (OR).
    """
    search: NotRequired[str]
    r"""Optional. Free-text substring search query matched case-insensitively
    against both `display_name` and `description`. Maximum 2048 bytes.
    """
    type: NotRequired[List[str]]
    r"""Optional. Filter by voice type. Accepts `\"prebuilt\"`, `\"replicated\"`,
    `\"prompted\"` (case-insensitive). If multiple values are specified, matches
    voices with any of the specified types (OR).
    """


class ListVoicesRequest(BaseModel):
    api_version: Annotated[
        Optional[str],
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ] = None
    r"""API version for request routing."""

    accent: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by accent description (e.g. \"American\", \"British\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified accents (OR).
    """

    contexts: Annotated[
        Optional[List[str]],
        pydantic.Field(alias="context"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by intended context or domain (e.g. \"News, Commercial\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified contexts (OR).
    """

    gender: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by gender presentation (e.g. \"female\", \"male\", \"neutral\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified genders (OR).
    """

    language_code: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by BCP-47 language code (e.g. \"en-US\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified language codes (OR).
    """

    page_size: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. The maximum number of voices to return per page. The service may
    return fewer than this value. If unspecified, at most 50 voices are
    returned. The maximum value is 1000; values above 1000 are coerced to
    1000.
    """

    page_token: Annotated[
        Optional[str],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. A page token received from a previous `ListVoices` call. Provide
    this to retrieve the subsequent page.

    When paginating, all filter query parameters (`language_code`,
    `region_code`, `accent`, `persona`, `context`, `gender`, `pitch`, `type`,
    and `search`) must match the call that returned this token; otherwise the
    request fails with `INVALID_ARGUMENT`. `page_size` may change between
    pages.
    """

    persona: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by vocal persona (e.g. \"Warm, Friendly\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified personas (OR).
    """

    pitch: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by vocal pitch. Accepts `\"low\"`, `\"medium\"`, `\"high\"`
    (case-insensitive). If multiple values are specified, matches voices with
    any of the specified pitches (OR).
    """

    region_code: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by ISO 3166-1 alpha-2 or UN M.49 region code (e.g. \"US\",
    \"001\").
    Case-insensitive exact match. If multiple values are specified, matches
    voices with any of the specified region codes (OR).
    """

    search: Annotated[
        Optional[str],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Free-text substring search query matched case-insensitively
    against both `display_name` and `description`. Maximum 2048 bytes.
    """

    type: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Optional. Filter by voice type. Accepts `\"prebuilt\"`, `\"replicated\"`,
    `\"prompted\"` (case-insensitive). If multiple values are specified, matches
    voices with any of the specified types (OR).
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "api_version",
                "accent",
                "contexts",
                "gender",
                "language_code",
                "page_size",
                "page_token",
                "persona",
                "pitch",
                "region_code",
                "search",
                "type",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
