-- name: CreateUserAudioResponse :one
INSERT INTO user_audio_responses (user_id, question_id, question_set_id, audio_object_key)
VALUES ($1, $2, $3, $4)
RETURNING *;

-- name: GetUserAudioResponse :one
SELECT *
FROM user_audio_responses
WHERE user_id = $1 AND question_id = $2 AND question_set_id = $3
ORDER BY created_at DESC
LIMIT 1;

-- name: ListUserAudioResponsesBySet :many
SELECT *
FROM user_audio_responses
WHERE user_id = $1 AND question_set_id = $2
ORDER BY created_at DESC;

-- name: DeleteUserAudioResponse :exec
DELETE FROM user_audio_responses
WHERE id = $1 AND user_id = $2;
