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

from __future__ import annotations
from datetime import datetime
from kombo.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict


IntegrationDeletedWebhookPayloadType = Literal["integration-deleted",]
r"""Type of the webhook event"""


IntegrationDeletedWebhookPayloadCategory = Literal[
    "HRIS",
    "ATS",
    "ASSESSMENT",
    "LMS",
]
r"""The category of the integration."""


class IntegrationDeletedWebhookPayloadEndUserTypedDict(TypedDict):
    r"""Information about the end user who created the integration."""

    organization_name: str
    r"""The name of the organization that owns the integration."""
    creator_email: Nullable[str]
    r"""The email address of the user who created the integration."""
    origin_id: Nullable[str]
    r"""The unique identifier of the organization in the integrated system."""


class IntegrationDeletedWebhookPayloadEndUser(BaseModel):
    r"""Information about the end user who created the integration."""

    organization_name: str
    r"""The name of the organization that owns the integration."""

    creator_email: Nullable[str]
    r"""The email address of the user who created the integration."""

    origin_id: Nullable[str]
    r"""The unique identifier of the organization in the integrated system."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                m[k] = val

        return m


class IntegrationDeletedWebhookPayloadDataTypedDict(TypedDict):
    id: str
    r"""The unique identifier of the deleted integration."""
    tool: str
    r"""The name of the integrated tool."""
    category: IntegrationDeletedWebhookPayloadCategory
    r"""The category of the integration."""
    end_user: IntegrationDeletedWebhookPayloadEndUserTypedDict
    r"""Information about the end user who created the integration."""
    deleted_at: datetime
    r"""ISO 8601 timestamp when the integration was deleted."""


class IntegrationDeletedWebhookPayloadData(BaseModel):
    id: str
    r"""The unique identifier of the deleted integration."""

    tool: str
    r"""The name of the integrated tool."""

    category: IntegrationDeletedWebhookPayloadCategory
    r"""The category of the integration."""

    end_user: IntegrationDeletedWebhookPayloadEndUser
    r"""Information about the end user who created the integration."""

    deleted_at: datetime
    r"""ISO 8601 timestamp when the integration was deleted."""


class IntegrationDeletedWebhookPayloadTypedDict(TypedDict):
    id: str
    r"""Unique identifier for this webhook event"""
    type: IntegrationDeletedWebhookPayloadType
    r"""Type of the webhook event"""
    data: IntegrationDeletedWebhookPayloadDataTypedDict


class IntegrationDeletedWebhookPayload(BaseModel):
    id: str
    r"""Unique identifier for this webhook event"""

    type: IntegrationDeletedWebhookPayloadType
    r"""Type of the webhook event"""

    data: IntegrationDeletedWebhookPayloadData
