//#region src/health.d.ts
/**
 * `@platform-modules/util/health` — a uniform health-probe contract + aggregator (pure, zero-dep).
 *
 * A site-health screen reports DB / mail / jobs / cache / storage reachability without bespoke
 * wiring: each infra module exports a `HealthCheck` factory; the host composes them into one
 * `aggregateHealth([...])` call for the modules it actually installed.
 *
 * Availability floor: a probe failure is a `HealthResult{status:'down'}`, NEVER a thrown
 * exception — the screen must render even when a dependency is dead.
 */
type HealthStatus = 'ok' | 'degraded' | 'down';
interface HealthResult {
  name: string;
  status: HealthStatus;
  detail?: string;
  latencyMs?: number;
}
/** The per-module contract: a named probe that resolves to a typed result (never throws by contract). */
interface HealthCheck {
  name: string;
  check(): Promise<HealthResult>;
}
/**
 * Run all checks (settled — a thrown/rejected check becomes `status:'down'`, never propagates),
 * roll up to the worst status: any 'down' => 'down'; else any 'degraded' => 'degraded'; else 'ok'.
 * An empty check set rolls up to 'ok' (nothing unhealthy).
 */
declare function aggregateHealth(checks: HealthCheck[]): Promise<{
  status: HealthStatus;
  checks: HealthResult[];
}>;
//#endregion
export { HealthCheck, HealthResult, HealthStatus, aggregateHealth };