-- name: ListStats :many
SELECT id, name, description, weight, allowed_amounts FROM stat
WHERE scope_id = ?;

-- name: GetStat :one
SELECT id, name, description, weight, allowed_amounts FROM stat
WHERE scope_id = ? AND id = ?;

-- name: InsertStat :execresult
INSERT INTO stat (scope_id, name, description, weight, allowed_amounts)
VALUES (?, ?, ?, ?, ?);

-- name: UpdateStat :exec
UPDATE stat SET
    name = ?,
    description = ?,
    weight = ?,
    allowed_amounts = ?
WHERE id = ? AND scope_id = ?;

-- name: DeleteStat :exec
DELETE FROM stat WHERE id = ? AND scope_id = ?;