/**
 * First-run setup utilities for Actuate CMS.
 *
 * Handles two setup paths:
 * 1. Interactive — setup wizard UI at /admin when no users exist
 * 2. Automated — env-var-based admin creation for CI/headless deploys
 */
export interface SetupStatus {
    setupRequired: boolean;
    userCount: number;
    /**
     * True when the database is reachable but the Actuate CMS tables don't exist
     * yet (migrations have not been applied). Distinct from `setupRequired`: the
     * fix is `prisma migrate deploy`, not the setup wizard.
     */
    migrationsRequired?: boolean;
}
export interface CreateAdminInput {
    email: string;
    password: string;
    name: string;
}
export interface SetupResult {
    success: boolean;
    error?: string;
    userId?: string;
}
/**
 * Detect errors that mean the database is unreachable / not initialized,
 * as opposed to an empty-but-healthy database.
 *
 * We must NOT treat these as "needs setup": doing so makes a DB outage
 * silently render the first-run account-creation wizard, and the
 * subsequent create-admin write then fails with an opaque 400. Surfacing
 * the error instead lets callers return a proper 5xx and lets operators
 * see the real cause (e.g. `ECONNREFUSED`, Prisma `P1001`).
 */
export declare function isDatabaseUnavailableError(err: unknown): boolean;
/**
 * Detect errors that mean the database is reachable but the Actuate CMS tables
 * have not been created yet (migrations not applied). This is a distinct,
 * recoverable state from "empty database" — surfacing it lets the UI tell the
 * operator to run migrations instead of dropping them on the login screen or a
 * wizard that will fail on the first write.
 */
export declare function isSchemaMissingError(err: unknown): boolean;
/**
 * Check if the CMS needs first-run setup (no admin users exist).
 * Uses a count query to avoid loading the full user model.
 *
 * A connection/initialization failure is rethrown so callers can report
 * it as an infrastructure error — only a successful query that returns
 * zero users counts as "setup required".
 */
export declare function checkSetupRequired(db: any): Promise<SetupStatus>;
/**
 * Create the initial admin user. Only succeeds if no users exist yet
 * (prevents race conditions and unauthorized account creation).
 */
export declare function createInitialAdmin(db: any, input: CreateAdminInput): Promise<SetupResult>;
/**
 * Attempt to auto-create admin from environment variables.
 * Called during CMS bootstrap if CMS_ADMIN_EMAIL and CMS_ADMIN_PASSWORD are set.
 * Silently no-ops if users already exist.
 */
export declare function autoSeedAdmin(db: any): Promise<SetupResult | null>;
//# sourceMappingURL=index.d.ts.map