-- name: CreateTaskWebhook :one
INSERT INTO task_webhooks (id, owner_id, url, events, secret)
VALUES ($1, $2, $3, COALESCE($4, '[]'), $5)
RETURNING *;

-- name: GetTaskWebhookByID :one
SELECT * FROM task_webhooks
WHERE id = $1 AND owner_id = $2;

-- name: ListTaskWebhooksByOwner :many
SELECT * FROM task_webhooks
WHERE owner_id = $1
ORDER BY created_at DESC;

-- name: DeleteTaskWebhook :exec
DELETE FROM task_webhooks WHERE id = $1 AND owner_id = $2;
