-- name: CreateConviteDiario :one
INSERT INTO convites_diarios (
    profissional_id, data, status, regiao
) VALUES (
    $1, $2, $3, $4
)
RETURNING *;

-- name: GetConvitesByProfissional :many
SELECT * FROM convites_diarios
WHERE profissional_id = $1
ORDER BY data ASC;

-- name: GetConvitesByDateAndRegion :many
SELECT * FROM convites_diarios
WHERE data = $1 AND regiao = $2;

-- name: GetConviteByProfissionalAndDate :one
SELECT * FROM convites_diarios
WHERE profissional_id = $1 AND data = $2;

-- name: UpdateConviteStatus :one
UPDATE convites_diarios
SET status = $2, motivo_rejeicao = $3, atualizado_em = NOW()
WHERE id = $1
RETURNING *;

-- name: DeleteConvite :exec
DELETE FROM convites_diarios
WHERE id = $1;
