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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class SubscriptionTestResult(UncheckedBaseModel):
    """
    Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    A Square-generated unique ID for the subscription test result.
    """

    status_code: typing.Optional[int] = pydantic.Field(default=None)
    """
    The HTTP status code returned by the notification URL.
    """

    payload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    The payload that was sent in the test notification.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the subscription was created, in RFC 3339 format. 
    For example, "2016-09-04T23:59:33.123Z".
    """

    updated_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
    Because a subscription test result is unique, this field is the same as the `created_at` field.
    """

    notification_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL that was used for the webhook notification test.
    """

    passes_filter: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the notification passed any configured filters.
    """

    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
