-- name: GetAllMailUsers :many
SELECT * FROM virtual_users;

-- name: GetUsersByDomain :many
SELECT * FROM virtual_users WHERE domain_id = ?;

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

-- name: GetUserByEmail :one
SELECT * FROM virtual_users WHERE email = ?;

-- name: CreateUser :exec
INSERT INTO virtual_users (domain_id, email, password, quota) VALUES (?, ?, ?, ?);

-- name: UpdateUserPassword :exec
UPDATE virtual_users SET password = ? WHERE id = ?;

-- name: UpdateUserQuota :exec
UPDATE virtual_users SET quota = ? WHERE id = ?;

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

-- name: CountUsersByDomain :one
SELECT COUNT(*) as count FROM virtual_users WHERE domain_id = ?;
