/**
 * SEO audit engine.
 *
 * Pure analysis: given a set of content entities (pages/posts) plus optional
 * cross-cutting signals (broken links, redirect chains/loops, sitemap/robots
 * health), it produces:
 *   - per-page SEO scores (via `calculatePageSeoScore`),
 *   - a flat list of detected issues with stable `issueKey`s,
 *   - an explainable site score (via `calculateSiteSeoScore`),
 *   - issue counts by severity, and
 *   - priority-ranked quick wins.
 *
 * The handler layer fetches the data, calls `runSeoAuditAnalysis`, and
 * snapshots the result into `SeoAuditRun` / `SeoIssue` rows. Keeping detection
 * pure means it is fully unit-testable with no DB.
 */
import { gradeForSeoScore, type SeoGrade, type SiteSeoScoreResult } from './score.js';
export type SeoSeverity = 'critical' | 'warning' | 'info';
export type SeoIssueCategory = 'content' | 'technical' | 'redirects' | 'media' | 'performance' | 'schema' | 'social' | 'indexing';
export interface AuditEntityInput {
    entityType: 'page' | 'post';
    entityId: string;
    title: string;
    url: string;
    content?: string;
    metaTitle?: string | null;
    metaDescription?: string | null;
    focusKeyword?: string | null;
    keyTakeaway?: string | null;
    canonicalUrl?: string | null;
    ogTitle?: string | null;
    ogDescription?: string | null;
    ogImage?: string | null;
    structuredDataType?: string | null;
    noindex?: boolean | null;
    shouldBeIndexable?: boolean;
    wordCount?: number | null;
}
export interface AuditExtraSignals {
    /** Broken internal links discovered by the link checker. */
    brokenLinks?: {
        url: string;
        fromEntityId: string;
        fromTitle: string;
        fromUrl: string;
    }[];
    /** Pages flagged as slow by an external performance source. */
    slowPages?: {
        entityId: string;
        title: string;
        url: string;
        note?: string;
    }[];
    redirectChains?: number;
    redirectLoops?: number;
    sitemapEnabled?: boolean;
    robotsEnabled?: boolean;
}
export interface DetectedIssue {
    issueKey: string;
    entityType: string | null;
    entityId: string | null;
    entityTitle: string | null;
    url: string | null;
    severity: SeoSeverity;
    category: SeoIssueCategory;
    type: string;
    title: string;
    description: string;
    impact: string;
    recommendation: string;
    fixable: boolean;
    fixActionType: string | null;
    relatedEntityIds: string[];
}
export interface AuditPageRecord {
    entityType: 'page' | 'post';
    entityId: string;
    title: string;
    url: string;
    score: number;
    grade: SeoGrade;
    metaTitleSet: boolean;
    metaDescriptionSet: boolean;
}
export interface QuickWin {
    id: string;
    title: string;
    explanation: string;
    impact: 'High' | 'Medium' | 'Low';
    issueType: string;
    fixActionType: string | null;
    count: number;
}
export interface SeoAuditResult {
    pages: AuditPageRecord[];
    issues: DetectedIssue[];
    siteScore: SiteSeoScoreResult;
    counts: {
        total: number;
        critical: number;
        warning: number;
        info: number;
    };
    quickWins: QuickWin[];
}
/** Stable per-issue key so status carries across audit runs. */
export declare function issueKeyFor(type: string, identifier: string): string;
/**
 * Run the full SEO audit analysis over a set of entities + signals.
 */
export declare function runSeoAuditAnalysis(entities: AuditEntityInput[], signals?: AuditExtraSignals): SeoAuditResult;
/**
 * Derive priority-ranked quick wins by grouping issues by type and ranking by
 * (impact, severity, count). Never hardcoded — purely a function of detected
 * issues, so the Overview "Quick Wins" card always reflects reality.
 */
export declare function buildQuickWins(issues: DetectedIssue[]): QuickWin[];
export { gradeForSeoScore };
//# sourceMappingURL=audit-engine.d.ts.map