-- name: CreatePerson :one
INSERT INTO identity.persons (user_id, display_name, primary_email, primary_email_verified)
VALUES ($1, $2, $3, $4)
RETURNING *;

-- name: GetPersonByUserID :one
SELECT * FROM identity.persons
WHERE user_id = $1;

-- name: GetPersonByID :one
SELECT * FROM identity.persons
WHERE person_id = $1;

-- name: UpdatePerson :one
UPDATE identity.persons
SET display_name = $1, primary_email = $2, primary_email_verified = $3
WHERE person_id = $4
RETURNING *;

-- name: ListPersons :many
SELECT * FROM identity.persons
ORDER BY display_name;
