-- name: CreateActivity :exec
INSERT INTO activities (id, tenant_id, type, deal_id, account_id, contact_id, title, due_at, status, assigned_user_id, created_at, updated_at)
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12);

-- name: ListActivities :many
SELECT * FROM activities WHERE tenant_id=$1 ORDER BY created_at DESC;

-- name: CompleteActivity :exec
UPDATE activities SET status='done', completed_at=$1, updated_at=$2 WHERE tenant_id=$3 AND id=$4;

-- name: CancelActivity :exec
UPDATE activities SET status='canceled', updated_at=$1 WHERE tenant_id=$2 AND id=$3;
