/**
 * Scan Registry Module
 *
 * Maintains a persistent registry of all scans for analytics,
 * case study identification, and compliance auditing.
 *
 * @module telemetry/registry
 */
import type { Severity, CertificationLevel } from "../certification/types.js";
/**
 * A record of a completed scan
 */
export interface ScanRecord {
    /** Unique scan ID */
    id: string;
    /** Certification ID if certified */
    certificationId?: string;
    /** Project path (can be redacted) */
    projectPath: string;
    /** SHA256 hash of project path for matching */
    projectHash: string;
    /** Repository URL (if opted in) */
    repoUrl?: string;
    /** Organization name (if opted in) */
    orgName?: string;
    /** User email (if opted in) */
    userEmail?: string;
    /** When the scan was performed */
    scanDate: string;
    /** Certification level achieved */
    level?: CertificationLevel;
    /** Overall score (0-100) */
    score?: number;
    /** Scan duration in milliseconds */
    duration: number;
    /** Findings by severity */
    findingsSummary: Record<Severity, number>;
    /** Total findings */
    totalFindings: number;
    /** Scanners that were run */
    scannersRun: string[];
    /** Frameworks assessed */
    frameworksAssessed: string[];
    /** Whether the scan succeeded */
    success: boolean;
    /** Error message if failed */
    errorMessage?: string;
    /** Whether user consented to case study */
    caseStudyConsent?: boolean;
    /** Tags for categorization */
    tags?: string[];
}
/**
 * Summary of findings for analytics
 */
export interface FindingSummary {
    /** Rule/check ID */
    ruleId: string;
    /** Scanner that found it */
    scanner: string;
    /** Category */
    category: string;
    /** Severity */
    severity: Severity;
    /** Number of occurrences across all scans */
    occurrences: number;
    /** Number of unique projects affected */
    projectsAffected: number;
}
/**
 * Analytics summary
 */
export interface RegistryAnalytics {
    /** Total scans recorded */
    totalScans: number;
    /** Successful scans */
    successfulScans: number;
    /** Failed scans */
    failedScans: number;
    /** Scans by certification level */
    byLevel: Record<CertificationLevel, number>;
    /** Scans by framework */
    byFramework: Record<string, number>;
    /** Scans by scanner */
    byScanner: Record<string, number>;
    /** Scans by month (YYYY-MM format) */
    byMonth: Record<string, number>;
    /** Average score */
    averageScore: number;
    /** Average scan duration in ms */
    averageDuration: number;
    /** Top findings */
    topFindings: FindingSummary[];
    /** Case study candidates count */
    caseStudyCandidates: number;
}
/**
 * Scan Registry for persistent tracking of all scans
 */
export declare class ScanRegistry {
    private records;
    private storagePath;
    private loaded;
    constructor(storagePath?: string);
    /**
     * Load registry from storage
     */
    load(): Promise<void>;
    /**
     * Save registry to storage
     */
    save(): Promise<void>;
    /**
     * Generate a unique scan ID
     */
    private generateScanId;
    /**
     * Hash a project path for matching
     */
    private hashProjectPath;
    /**
     * Record a new scan
     */
    recordScan(record: Omit<ScanRecord, "id" | "projectHash">): Promise<ScanRecord>;
    /**
     * Get a scan by ID
     */
    getScan(scanId: string): Promise<ScanRecord | undefined>;
    /**
     * Get scans for a project (by path or hash)
     */
    getScansForProject(projectPathOrHash: string): Promise<ScanRecord[]>;
    /**
     * Get scans for an organization
     */
    getScansForOrg(orgName: string): Promise<ScanRecord[]>;
    /**
     * Get recent scans
     */
    getRecentScans(limit?: number): Promise<ScanRecord[]>;
    /**
     * Get successful scans with high scores (case study candidates)
     */
    getCaseStudyCandidates(minScore?: number): Promise<ScanRecord[]>;
    /**
     * Get all unique organizations
     */
    getOrganizations(): Promise<string[]>;
    /**
     * Get analytics summary
     */
    getAnalytics(): Promise<RegistryAnalytics>;
    /**
     * Export registry to JSON
     */
    exportToJson(): Promise<string>;
    /**
     * Export analytics to JSON
     */
    exportAnalyticsToJson(): Promise<string>;
    /**
     * Get total scan count
     */
    getCount(): Promise<number>;
    /**
     * Clear all records (use with caution)
     */
    clear(): Promise<void>;
}
/**
 * Get the singleton registry instance
 */
export declare function getRegistry(storagePath?: string): ScanRegistry;
/**
 * Reset the singleton (for testing)
 */
export declare function resetRegistry(): void;
//# sourceMappingURL=registry.d.ts.map