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

from __future__ import annotations
from .member import Member, MemberTypedDict
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 WebhookMemberCreatedPayloadTypedDict(TypedDict):
    r"""Sent when a new member is created.

    A member represents an individual within a customer (team).
    This event is triggered when a member is added to a customer,
    either programmatically via the API or when an owner is automatically
    created for a new customer.

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

    timestamp: datetime
    data: MemberTypedDict
    r"""A member of a customer."""
    type: Literal["member.created"]


class WebhookMemberCreatedPayload(BaseModel):
    r"""Sent when a new member is created.

    A member represents an individual within a customer (team).
    This event is triggered when a member is added to a customer,
    either programmatically via the API or when an owner is automatically
    created for a new customer.

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

    timestamp: datetime

    data: Member
    r"""A member of a customer."""

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