/** Ensure a role name exists in the lt_roles lookup table (FK target). */
export declare const ENSURE_ROLE_EXISTS = "INSERT INTO lt_roles (role) VALUES ($1) ON CONFLICT DO NOTHING";
/** Fetch roles for a single user, ordered by creation time. */
export declare const GET_ROLES_BY_USER_ID = "SELECT role, type, created_at FROM lt_user_roles WHERE user_id = $1 ORDER BY created_at";
/** Fetch a user row by external_id. */
export declare const GET_USER_BY_EXTERNAL_ID = "SELECT * FROM lt_users WHERE external_id = $1";
export declare const INSERT_USER = "INSERT INTO lt_users (external_id, email, display_name, status, metadata, password_hash, oauth_provider, oauth_provider_id)\n   VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n   RETURNING *";
export declare const GET_USER_BY_EMAIL = "SELECT * FROM lt_users WHERE email = $1 LIMIT 1";
export declare const INSERT_USER_ROLE_IGNORE = "INSERT INTO lt_user_roles (user_id, role, type) VALUES ($1, $2, $3)\n   ON CONFLICT DO NOTHING";
export declare const GET_USER_BY_ID = "SELECT * FROM lt_users WHERE id = $1";
/** Check if a user exists by id. Lightweight — returns only the id column. */
export declare const VERIFY_USER_BY_ID = "SELECT id FROM lt_users WHERE id = $1 LIMIT 1";
/** Fetch user + roles in a single query. Returns one row per role (or one row with nulls if no roles). */
export declare const GET_USER_WITH_ROLES = "SELECT u.id, u.external_id, u.display_name, u.status, u.metadata,\n          r.role, r.type AS role_type\n   FROM lt_users u\n   LEFT JOIN lt_user_roles r ON r.user_id = u.id\n   WHERE u.external_id = $1\n   ORDER BY r.created_at";
export declare const DELETE_USER_BY_ID = "DELETE FROM lt_users WHERE id = $1";
/** Batch-load roles for many users (avoids N+1). */
export declare const GET_ROLES_BY_USER_IDS = "SELECT user_id, role, type, created_at FROM lt_user_roles WHERE user_id = ANY($1) ORDER BY created_at";
/** Upsert a user–role assignment, promoting the type if the row exists. */
export declare const UPSERT_USER_ROLE = "INSERT INTO lt_user_roles (user_id, role, type) VALUES ($1, $2, $3)\n   ON CONFLICT (user_id, role) DO UPDATE SET type = EXCLUDED.type\n   RETURNING role, type, created_at";
export declare const DELETE_USER_ROLE = "DELETE FROM lt_user_roles WHERE user_id = $1 AND role = $2";
export declare const HAS_ROLE = "SELECT 1 FROM lt_user_roles WHERE user_id = $1 AND role = $2 LIMIT 1";
export declare const HAS_ROLE_TYPE = "SELECT 1 FROM lt_user_roles WHERE user_id = $1 AND type = $2 LIMIT 1";
/** Check if a user is an admin (or superadmin) of a specific role group. */
export declare const IS_GROUP_ADMIN = "SELECT 1 FROM lt_user_roles\n   WHERE user_id = $1\n     AND (\n       (role = $2 AND type IN ('admin', 'superadmin'))\n       OR type = 'superadmin'\n     )\n   LIMIT 1";
