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

from __future__ import annotations
from .subscription import Subscription, SubscriptionTypedDict
from polar_sdk.types import BaseModel
from polar_sdk.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict


class WebhookSubscriptionRevokedPayloadTypedDict(TypedDict):
    r"""Sent when a subscription is revoked, the user looses access immediately.
    Happens when the subscription is canceled, or payment is past due.

    **Discord & Slack support:** Full
    """

    data: SubscriptionTypedDict
    type: Literal["subscription.revoked"]


class WebhookSubscriptionRevokedPayload(BaseModel):
    r"""Sent when a subscription is revoked, the user looses access immediately.
    Happens when the subscription is canceled, or payment is past due.

    **Discord & Slack support:** Full
    """

    data: Subscription

    TYPE: Annotated[
        Annotated[
            Literal["subscription.revoked"],
            AfterValidator(validate_const("subscription.revoked")),
        ],
        pydantic.Field(alias="type"),
    ] = "subscription.revoked"
