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

from __future__ import annotations
from moovio_sdk.models.components import (
    wallet as components_wallet,
    walletstatus as components_walletstatus,
    wallettype as components_wallettype,
)
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
from moovio_sdk.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ListWalletsRequestTypedDict(TypedDict):
    account_id: str
    status: NotRequired[components_walletstatus.WalletStatus]
    r"""Optional parameter for filtering wallets by status."""
    wallet_type: NotRequired[components_wallettype.WalletType]
    r"""Optional parameter for filtering wallets by type."""
    skip: NotRequired[int]
    count: NotRequired[int]


class ListWalletsRequest(BaseModel):
    account_id: Annotated[
        str,
        pydantic.Field(alias="accountID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]

    status: Annotated[
        Optional[components_walletstatus.WalletStatus],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional parameter for filtering wallets by status."""

    wallet_type: Annotated[
        Optional[components_wallettype.WalletType],
        pydantic.Field(alias="walletType"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Optional parameter for filtering wallets by type."""

    skip: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    count: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["status", "walletType", "skip", "count"])
        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 ListWalletsResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: List[components_wallet.WalletTypedDict]


class ListWalletsResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: List[components_wallet.Wallet]
