# This file was generated by liblab | https://liblab.com/

from enum import Enum
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel


class WebhookItemStatus(Enum):
    """An enumeration representing different categories.

    :cvar ENABLED: "enabled"
    :vartype ENABLED: str
    :cvar DISABLED: "disabled"
    :vartype DISABLED: str
    """

    ENABLED = "enabled"
    DISABLED = "disabled"

    def list():
        """Lists all category values.

        :return: A list of all category values.
        :rtype: list
        """
        return list(map(lambda x: x.value, WebhookItemStatus._member_map_.values()))


@JsonMap({"id_": "id"})
class WebhookItem(BaseModel):
    """WebhookItem

    :param id_: Unique identifier of this resource.
    :type id_: str
    :param name: Webhook subscription name.
    :type name: str
    :param description: Webhook subscription description.
    :type description: str
    :param status: Status of webhook.
    :type status: WebhookItemStatus
    :param url: Endpoint to receive webhook.
    :type url: str
    :param signing_key: The webhook's signing key, used to generate webhook signatures.
    :type signing_key: str
    :param api_version: Deel API version. Currently Deel accepts v1 or v2 version.
    :type api_version: str
    :param events: The list of events to enable for this subscription.
    :type events: List[str]
    :param created_at: Time at which the webhook was created.
    :type created_at: str
    :param updated_at: Time at which the webhook was updated.
    :type updated_at: str
    :param hidden: Property to hide the webhook from frontend view. Commonly by Dell 3rd party apps, defaults to None
    :type hidden: bool, optional
    :param internal: internal, defaults to None
    :type internal: bool, optional
    :param deleted_at: Time at which the webhook was deleted., defaults to None
    :type deleted_at: str, optional
    """

    def __init__(
        self,
        id_: str,
        name: str,
        description: str,
        status: WebhookItemStatus,
        url: str,
        signing_key: str,
        api_version: str,
        events: List[str],
        created_at: str,
        updated_at: str,
        hidden: bool = None,
        internal: bool = None,
        deleted_at: str = None,
    ):
        self.id_ = id_
        self.name = name
        self.description = description
        self.status = self._enum_matching(status, WebhookItemStatus.list(), "status")
        self.url = url
        self.signing_key = signing_key
        self.api_version = api_version
        self.events = events
        self.created_at = created_at
        self.updated_at = updated_at
        if hidden is not None:
            self.hidden = hidden
        if internal is not None:
            self.internal = internal
        if deleted_at is not None:
            self.deleted_at = deleted_at
