# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .api_version_enum import ApiVersionEnum
from .webhook_advanced_options import WebhookAdvancedOptions
from .webhook_endpoint_event_type import WebhookEndpointEventType
from .webhook_endpoint_status import WebhookEndpointStatus


class WebhookEndpoint(UncheckedBaseModel):
    object: typing.Literal["webhook_endpoint"] = "webhook_endpoint"
    id: str = pydantic.Field()
    """
    Unique identifier for the webhook endpoint.
    """

    url: str = pydantic.Field()
    """
    The URL that webhook events are sent to.
    """

    name: str = pydantic.Field()
    """
    A human-readable name for the webhook endpoint.
    """

    status: WebhookEndpointStatus
    enabled_events: typing_extensions.Annotated[
        typing.List[WebhookEndpointEventType], FieldMetadata(alias="enabledEvents")
    ] = pydantic.Field(alias="enabledEvents")
    """
    The list of event types this endpoint is subscribed to at the global level. These are events that are not scoped to a specific resource.
    """

    api_version: typing_extensions.Annotated[ApiVersionEnum, FieldMetadata(alias="apiVersion")] = pydantic.Field(
        alias="apiVersion"
    )
    advanced_options: typing_extensions.Annotated[
        typing.Optional[WebhookAdvancedOptions], FieldMetadata(alias="advancedOptions")
    ] = pydantic.Field(alias="advancedOptions", default=None)
    """
    Advanced configuration options for the webhook endpoint, including custom headers and payload delivery settings.
    """

    created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] = pydantic.Field(
        alias="createdAt"
    )
    """
    The date and time the webhook endpoint was created.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
