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

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


class AgentsAPIV1AgentsListVersionsRequestTypedDict(TypedDict):
    agent_id: str
    page: NotRequired[int]
    r"""Page number (0-indexed)"""
    page_size: NotRequired[int]
    r"""Number of versions per page"""


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

    page: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = 0
    r"""Page number (0-indexed)"""

    page_size: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = 20
    r"""Number of versions per page"""

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

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

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

        return m
