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

from __future__ import annotations
from .order import Order, OrderTypedDict
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 WebhookOrderCreatedPayloadType(str, Enum):
    ORDER_CREATED = "order.created"


class WebhookOrderCreatedPayloadTypedDict(TypedDict):
    r"""Sent when a new order is created.

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

    data: OrderTypedDict
    type: WebhookOrderCreatedPayloadType


class WebhookOrderCreatedPayload(BaseModel):
    r"""Sent when a new order is created.

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

    data: Order

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