-- name: FindAllUsers :many
SELECT * FROM users;

-- name: FindAdminUsers :many
SELECT * FROM users WHERE created_by = $1;

-- name: InsertUser :one
INSERT INTO users (
    email, full_name, password_hash, is_admin, created_by
) VALUES (
    $1, $2, $3, $4, $5
)
RETURNING id;

-- name: FindUserEmail :one
SELECT * FROM users WHERE email = $1 LIMIT 1;

-- name: FindUserId :one
SELECT * FROM users WHERE id = $1 LIMIT 1;

-- name: UpdateProfilePicture :exec
UPDATE users
SET profile_picture = $1
WHERE id = $2;

-- name: UpdateLastLogin :exec
UPDATE users
SET last_login = NOW()
WHERE id = $1;
