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

from __future__ import annotations
from .capabilityid import CapabilityID
from .capabilitystatus import CapabilityStatus
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class WebhookDataCapabilityUpdatedTypedDict(TypedDict):
    account_id: str
    capability_id: CapabilityID
    r"""Moov account capabilities.

    The `production-app`, `platform.production-app`, and / or `platform.wallet-transfers` capabilities might appear in your list. These are read-only capabilities that Moov requests and uses for account verification purposes. These capabilities remains active with your account and require no additional action.
    """
    status: CapabilityStatus
    r"""The status of the capability requested for an account."""
    foreign_id: NotRequired[str]


class WebhookDataCapabilityUpdated(BaseModel):
    account_id: Annotated[str, pydantic.Field(alias="accountID")]

    capability_id: Annotated[CapabilityID, pydantic.Field(alias="capabilityID")]
    r"""Moov account capabilities.

    The `production-app`, `platform.production-app`, and / or `platform.wallet-transfers` capabilities might appear in your list. These are read-only capabilities that Moov requests and uses for account verification purposes. These capabilities remains active with your account and require no additional action.
    """

    status: CapabilityStatus
    r"""The status of the capability requested for an account."""

    foreign_id: Annotated[Optional[str], pydantic.Field(alias="foreignID")] = None

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


try:
    WebhookDataCapabilityUpdated.model_rebuild()
except NameError:
    pass
