/**
 * Content health cron — runs `scanDocument` across published
 * documents in chunks, upserts findings into
 * `actuate_content_issues`, and deletes rows whose issue resolved
 * since the previous run.
 *
 * ## Why chunked iteration
 *
 * A single full scan over a 10k-doc corpus does ~10k HTML parses
 * plus up to ~50k internal-link probes (HEAD requests with 5s
 * timeouts). On Vercel that quickly approaches the function
 * wall-time cap. We batch in `BATCH_SIZE` pages and yield to the
 * event loop between batches so a 10-minute cron can make
 * incremental progress even when the corpus is large.
 *
 * ## Why upsert + delete-stale
 *
 * The scanner is the source of truth. After a run, any (docId, type)
 * pair NOT emitted by the scan no longer applies — the editor
 * fixed the issue, the document was unpublished, etc. We track
 * pairs we've seen and DELETE the unseen ones at the end.
 *
 * ## Why we never delete on partial failure
 *
 * If the scan throws mid-run, we abandon the delete step. Better
 * to over-report (a previously-recorded issue may already be
 * resolved) than to silently drop a real issue because the scan
 * crashed before reaching that document.
 */
import { type ContentIssueKind } from './scanner.js';
type PrismaDB = any;
export interface ContentHealthScanOptions {
    /** Cap the number of documents processed per run. Default 500. */
    maxDocuments?: number;
    /** Documents per DB query / processing chunk. Default 50. */
    batchSize?: number;
    /** Origin to resolve internal links against. Required for link checking. */
    siteOrigin?: string | null;
    /**
     * Per-link probe timeout in milliseconds. Default 5000. Set
     * shorter on CI to keep test runtimes bounded.
     */
    linkProbeTimeoutMs?: number;
    /**
     * Test seam — inject a synchronous link checker so unit tests
     * don't fan out real HEAD requests. Defaults to
     * `checkInternalLinkReachable`.
     */
    checkLink?: ((url: string) => Promise<boolean>) | null;
}
export interface ContentHealthScanResult {
    /** Number of documents scanned. */
    scanned: number;
    /** New issue rows inserted (didn't exist before). */
    inserted: number;
    /** Existing issue rows updated (count or details changed). */
    updated: number;
    /** Issue rows deleted (no longer apply). */
    resolved: number;
    /** Map of `type` → total count across all docs at end of scan. */
    totals: Record<ContentIssueKind, number>;
    /** True if the scan stopped early because maxDocuments was reached. */
    truncated: boolean;
}
export declare function processContentHealthScan(db: PrismaDB, options?: ContentHealthScanOptions): Promise<ContentHealthScanResult>;
export {};
//# sourceMappingURL=cron.d.ts.map