-- name: CreateQuestionShortAnswer :one
INSERT INTO question_short_answers (
    question_id,
    acceptable_answer,
    match_type
)
VALUES ($1, $2, COALESCE($3, 'EXACT'))
RETURNING *;

-- name: GetShortAnswersByQuestionID :many
SELECT *
FROM question_short_answers
WHERE question_id = $1;

-- name: UpdateQuestionShortAnswer :exec
UPDATE question_short_answers
SET
    acceptable_answer = COALESCE($1, acceptable_answer),
    match_type = COALESCE($2, match_type)
WHERE id = $3;

-- name: DeleteQuestionShortAnswer :exec
DELETE FROM question_short_answers
WHERE id = $1;

-- name: DeleteShortAnswersByQuestionID :exec
DELETE FROM question_short_answers
WHERE question_id = $1;
