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

from __future__ import annotations
from .entity_capability import EntityCapability, EntityCapabilityTypedDict
from .url import URL, URLTypedDict
from mollie.types import BaseModel, UNSET_SENTINEL
from mollie.utils import FieldMetadata, HeaderMetadata
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ListCapabilitiesRequestTypedDict(TypedDict):
    idempotency_key: NotRequired[str]
    r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""


class ListCapabilitiesRequest(BaseModel):
    idempotency_key: Annotated[
        Optional[str],
        pydantic.Field(alias="idempotency-key"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["idempotency-key"])
        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 ListCapabilitiesEmbeddedTypedDict(TypedDict):
    capabilities: List[EntityCapabilityTypedDict]


class ListCapabilitiesEmbedded(BaseModel):
    capabilities: List[EntityCapability]


class ListCapabilitiesLinksTypedDict(TypedDict):
    documentation: NotRequired[URLTypedDict]
    r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""


class ListCapabilitiesLinks(BaseModel):
    documentation: Optional[URL] = None
    r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["documentation"])
        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 ListCapabilitiesResponseTypedDict(TypedDict):
    r"""A list of capabilities."""

    count: int
    r"""The number of items in this result set."""
    embedded: ListCapabilitiesEmbeddedTypedDict
    links: ListCapabilitiesLinksTypedDict


class ListCapabilitiesResponse(BaseModel):
    r"""A list of capabilities."""

    count: int
    r"""The number of items in this result set."""

    embedded: Annotated[ListCapabilitiesEmbedded, pydantic.Field(alias="_embedded")]

    links: Annotated[ListCapabilitiesLinks, pydantic.Field(alias="_links")]


try:
    ListCapabilitiesResponse.model_rebuild()
except NameError:
    pass
