"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 4c6ad704479b

from __future__ import annotations
from .connectortool import ConnectorTool, ConnectorToolTypedDict
from .mcptool import MCPTool, MCPToolTypedDict
from mistralai.client.types import BaseModel, UNSET_SENTINEL
from mistralai.client.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
from pydantic import model_serializer
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


class ConnectorListToolsV1RequestTypedDict(TypedDict):
    connector_id_or_name: str
    page: NotRequired[int]
    page_size: NotRequired[int]
    refresh: NotRequired[bool]
    pretty: NotRequired[bool]
    r"""Return a simplified payload with only name, description, annotations, and a compact inputSchema."""


class ConnectorListToolsV1Request(BaseModel):
    connector_id_or_name: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]

    page: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = 1

    page_size: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = 100

    refresh: Annotated[
        Optional[bool],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = False

    pretty: Annotated[
        Optional[bool],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = False
    r"""Return a simplified payload with only name, description, annotations, and a compact inputSchema."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["page", "page_size", "refresh", "pretty"])
        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


ResponseConnectorListToolsV1TypedDict = TypeAliasType(
    "ResponseConnectorListToolsV1TypedDict",
    Union[List[ConnectorToolTypedDict], List[MCPToolTypedDict], List[Dict[str, Any]]],
)
r"""Successful Response"""


ResponseConnectorListToolsV1 = TypeAliasType(
    "ResponseConnectorListToolsV1",
    Union[List[ConnectorTool], List[MCPTool], List[Dict[str, Any]]],
)
r"""Successful Response"""
