import type { Db } from '../client'

/**
 * System/admin query factory — no tenant scope.
 * For /api/admin/* routes only.
 * Admin routes must be protected by admin-role assertion before calling this.
 *
 * Returns system-level helper objects.
 * Downstream specs add their helpers to the returned object.
 */
export interface SystemQueryResult {
  _db: Db
}

export function systemQuery(db: Db): SystemQueryResult {
  return {
    _db: db,
    // Populated by downstream specs, e.g.:
    // tenants: tenantsAdminQuery(db),
    // users: usersAdminQuery(db),
  }
}
