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

from __future__ import annotations
from .order import Order, OrderTypedDict
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 WebhookOrderRefundedPayloadTypedDict(TypedDict):
    r"""Sent when an order is fully or partially refunded.

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

    timestamp: datetime
    data: OrderTypedDict
    type: Literal["order.refunded"]


class WebhookOrderRefundedPayload(BaseModel):
    r"""Sent when an order is fully or partially refunded.

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

    timestamp: datetime

    data: Order

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