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

from __future__ import annotations
from .pledge import Pledge, PledgeTypedDict
from enum import Enum
from polar_sdk.types import BaseModel
from polar_sdk.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing_extensions import Annotated, TypedDict


class WebhookPledgeUpdatedPayloadType(str, Enum):
    PLEDGE_UPDATED = "pledge.updated"


class WebhookPledgeUpdatedPayloadTypedDict(TypedDict):
    r"""Sent when a pledge is updated.

    **Discord & Slack support:** Basic
    """

    data: PledgeTypedDict
    type: WebhookPledgeUpdatedPayloadType


class WebhookPledgeUpdatedPayload(BaseModel):
    r"""Sent when a pledge is updated.

    **Discord & Slack support:** Basic
    """

    data: Pledge

    TYPE: Annotated[
        Annotated[
            WebhookPledgeUpdatedPayloadType,
            AfterValidator(
                validate_const(WebhookPledgeUpdatedPayloadType.PLEDGE_UPDATED)
            ),
        ],
        pydantic.Field(alias="type"),
    ] = WebhookPledgeUpdatedPayloadType.PLEDGE_UPDATED
