-- name: CreateUser :one
INSERT INTO users (oidc_subject, username, email)
VALUES (?, ?, ?)
RETURNING *;

-- name: GetUserByID :one
SELECT * FROM users
WHERE id = ?;

-- name: GetUserByOIDCSubject :one
SELECT * FROM users
WHERE oidc_subject = ?;

-- name: UpdateUser :one
UPDATE users
SET username = ?, email = ?
WHERE id = ?
RETURNING *;

-- name: DeleteUser :exec
DELETE FROM users
WHERE id = ?;

-- name: ListUsers :many
SELECT * FROM users
ORDER BY username;