"""Webhooks Resource."""

from typing import Any, Dict

from netorca_sdk.v2.base import BaseResource
from netorca_sdk.v2.models.webhook import Webhook


class WebhooksResource(BaseResource):
    """Webhooks resource."""

    endpoint = "webhooks"
    model_class = Webhook

    def trigger(self, webhook_id: int) -> Dict[str, Any]:
        """
        Manually trigger a webhook.

        Args:
            webhook_id: Webhook ID

        Returns:
            Trigger response
        """
        return self.client.post(
            self.endpoint,
            data={},
            custom_path=f"webhooks/{webhook_id}/trigger"
        )
