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

from __future__ import annotations
from .subscription import Subscription, SubscriptionTypedDict
from datetime import datetime
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 WebhookSubscriptionUncanceledPayloadTypedDict(TypedDict):
    r"""Sent when a customer revokes a pending cancellation.

    When a customer cancels with \"at period end\", they retain access until the
    subscription would renew. During this time, they can change their mind and
    undo the cancellation. This event is triggered when they do so.

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

    timestamp: datetime
    data: SubscriptionTypedDict
    type: Literal["subscription.uncanceled"]


class WebhookSubscriptionUncanceledPayload(BaseModel):
    r"""Sent when a customer revokes a pending cancellation.

    When a customer cancels with \"at period end\", they retain access until the
    subscription would renew. During this time, they can change their mind and
    undo the cancellation. This event is triggered when they do so.

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

    timestamp: datetime

    data: Subscription

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