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

from __future__ import annotations
from .benefitgrantwebhook import BenefitGrantWebhook, BenefitGrantWebhookTypedDict
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 WebhookBenefitGrantRevokedPayloadType(str, Enum):
    BENEFIT_GRANT_REVOKED = "benefit_grant.revoked"


class WebhookBenefitGrantRevokedPayloadTypedDict(TypedDict):
    r"""Sent when a new benefit grant is revoked.

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

    data: BenefitGrantWebhookTypedDict
    type: WebhookBenefitGrantRevokedPayloadType


class WebhookBenefitGrantRevokedPayload(BaseModel):
    r"""Sent when a new benefit grant is revoked.

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

    data: BenefitGrantWebhook

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