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

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


class DeleteCustomerRequestTypedDict(TypedDict):
    id: str
    r"""The unique identifier of the customer."""


class DeleteCustomerRequest(BaseModel):
    id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The unique identifier of the customer."""


DeleteCustomerError = Literal["conflict",]


DeleteCustomerType = Union[
    Literal[
        "subscriptions",
        "invoices",
        "disputes",
        "entitlements",
    ],
    UnrecognizedStr,
]


class ItemTypedDict(TypedDict):
    id: NotRequired[str]
    status: NotRequired[str]


class Item(BaseModel):
    id: Optional[str] = None

    status: Optional[str] = None

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


class DeleteCustomerBlockerTypedDict(TypedDict):
    type: DeleteCustomerType
    count: int
    items: List[ItemTypedDict]


class DeleteCustomerBlocker(BaseModel):
    type: DeleteCustomerType

    count: int

    items: List[Item]


class DeleteCustomerDetailsTypedDict(TypedDict):
    blockers: NotRequired[List[DeleteCustomerBlockerTypedDict]]


class DeleteCustomerDetails(BaseModel):
    blockers: Optional[List[DeleteCustomerBlocker]] = None

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