/**
 * Identity-table DDL — `CREATE TABLE`, index, and seed statements for the
 * core auth tables (account, actor, role_grant, auth_session, api_token,
 * bootstrap_lock, invite, app_settings).
 *
 * Consumed by `auth/migrations.ts`. Paired with `auth/audit_log_ddl.ts`
 * (audit table) and `auth/role_grant_offer_ddl.ts` (offer table) — DDL lives
 * in `*_ddl.ts`, Zod schemas in `*_schema.ts`.
 *
 * @module
 */
export declare const ACCOUNT_SCHEMA = "\nCREATE TABLE IF NOT EXISTS account (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  username TEXT UNIQUE NOT NULL,\n  email TEXT,\n  email_verified BOOLEAN NOT NULL DEFAULT false,\n  password_hash TEXT NOT NULL,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  created_by UUID,\n  updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_by UUID,\n  deleted_at TIMESTAMPTZ,\n  deleted_by UUID\n)";
export declare const ACTOR_SCHEMA = "\nCREATE TABLE IF NOT EXISTS actor (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  account_id UUID NOT NULL REFERENCES account(id) ON DELETE CASCADE,\n  name TEXT NOT NULL,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  updated_at TIMESTAMPTZ,\n  updated_by UUID REFERENCES actor(id) ON DELETE SET NULL,\n  deleted_at TIMESTAMPTZ,\n  deleted_by UUID REFERENCES actor(id) ON DELETE SET NULL\n)";
export declare const ACTOR_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_actor_account ON actor(account_id)";
/**
 * Functional index on `LOWER(actor.name)` supporting case-insensitive
 * prefix search by `actor_search` (`LOWER(name) LIKE LOWER(query) || '%'`).
 * `text_pattern_ops` keeps the LIKE-prefix pattern index-eligible — without
 * it the planner falls back to a sequential scan once the table grows.
 */
export declare const ACTOR_NAME_LOWER_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_actor_name_lower ON actor (LOWER(name) text_pattern_ops)";
export declare const ROLE_GRANT_SCHEMA = "\nCREATE TABLE IF NOT EXISTS role_grant (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  actor_id UUID NOT NULL REFERENCES actor(id) ON DELETE CASCADE,\n  role TEXT NOT NULL,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  expires_at TIMESTAMPTZ,\n  revoked_at TIMESTAMPTZ,\n  revoked_by UUID REFERENCES actor(id) ON DELETE SET NULL,\n  granted_by UUID REFERENCES actor(id) ON DELETE SET NULL\n)";
export declare const ROLE_GRANT_INDEXES: string[];
export declare const AUTH_SESSION_SCHEMA = "\nCREATE TABLE IF NOT EXISTS auth_session (\n  id TEXT PRIMARY KEY,\n  account_id UUID NOT NULL REFERENCES account(id) ON DELETE CASCADE,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  expires_at TIMESTAMPTZ NOT NULL,\n  last_seen_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n)";
export declare const AUTH_SESSION_INDEXES: string[];
export declare const API_TOKEN_SCHEMA = "\nCREATE TABLE IF NOT EXISTS api_token (\n  id TEXT PRIMARY KEY,\n  account_id UUID NOT NULL REFERENCES account(id) ON DELETE CASCADE,\n  name TEXT NOT NULL,\n  token_hash TEXT NOT NULL,\n  expires_at TIMESTAMPTZ,\n  last_used_at TIMESTAMPTZ,\n  last_used_ip TEXT,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n)";
export declare const ACCOUNT_EMAIL_INDEX = "\nCREATE UNIQUE INDEX IF NOT EXISTS idx_account_email ON account (LOWER(email)) WHERE email IS NOT NULL";
export declare const ACCOUNT_USERNAME_CI_INDEX = "\nCREATE UNIQUE INDEX IF NOT EXISTS idx_account_username_ci ON account (LOWER(username))";
export declare const API_TOKEN_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_api_token_account ON api_token(account_id)";
export declare const BOOTSTRAP_LOCK_SCHEMA = "\nCREATE TABLE IF NOT EXISTS bootstrap_lock (\n  id INTEGER PRIMARY KEY DEFAULT 1 CHECK (id = 1),\n  bootstrapped BOOLEAN NOT NULL DEFAULT false\n)";
/** Seed the bootstrap_lock table, setting `bootstrapped` based on whether accounts exist. */
export declare const BOOTSTRAP_LOCK_SEED = "\nINSERT INTO bootstrap_lock (id, bootstrapped)\n  SELECT 1, EXISTS(SELECT 1 FROM account)\n  ON CONFLICT DO NOTHING";
export declare const INVITE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS invite (\n  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n  email TEXT,\n  username TEXT,\n  claimed_by UUID REFERENCES account(id) ON DELETE SET NULL,\n  claimed_at TIMESTAMPTZ,\n  created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n  created_by UUID REFERENCES actor(id) ON DELETE SET NULL,\n  CONSTRAINT invite_has_identifier CHECK (email IS NOT NULL OR username IS NOT NULL)\n)";
export declare const INVITE_INDEXES: string[];
export declare const APP_SETTINGS_SCHEMA = "\nCREATE TABLE IF NOT EXISTS app_settings (\n  id INTEGER PRIMARY KEY DEFAULT 1 CHECK (id = 1),\n  open_signup BOOLEAN NOT NULL DEFAULT false,\n  updated_at TIMESTAMPTZ,\n  updated_by UUID\n)";
export declare const APP_SETTINGS_SEED = "\nINSERT INTO app_settings (id) VALUES (1) ON CONFLICT DO NOTHING";
//# sourceMappingURL=auth_ddl.d.ts.map