-- name: GetUser :one
SELECT * FROM users WHERE uid = $1 LIMIT 1;

-- name: GetUserUid :one
SELECT uid FROM users WHERE id = $1 LIMIT 1;

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

-- name: DeleteUser :exec
DELETE FROM users WHERE uid = $1;

-- name: CreateUser :exec
INSERT INTO users (uid, email, full_name, displayname) 
VALUES ($1, $2, $3, $4) 
RETURNING id;

-- name: UpdateUserData :exec
UPDATE users 
SET email = COALESCE($2, email), 
    full_name = COALESCE($3, full_name), 
    displayname = COALESCE($4, displayname),
    updated_at = CURRENT_TIMESTAMP
WHERE uid = $1;

