-- 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, email_verified, full_name, username) 
VALUES ($1, $2, $3, $4, $5) 
RETURNING id;

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

