/**
 * ProvenanceVerifier - Hash integrity and chain verification
 *
 * Constitution Compliance:
 * - CP-003: Immutable Hash Verification
 * - CP-001: Complete Provenance Chain
 *
 * FAIL FAST: All errors throw immediately
 * NO MOCKS: Tests use real DatabaseService
 */
import { DatabaseService } from '../storage/database/index.js';
import { ProvenanceTracker } from './tracker.js';
import { ProvenanceType, VerificationResult } from '../../models/provenance.js';
/** Error codes for verifier operations */
export declare const VerifierErrorCode: {
    readonly INTEGRITY_FAILED: "INTEGRITY_VERIFICATION_FAILED";
    readonly CONTENT_NOT_FOUND: "CONTENT_NOT_FOUND";
    readonly FILE_NOT_FOUND: "SOURCE_FILE_NOT_FOUND";
    readonly HASH_FORMAT_INVALID: "HASH_FORMAT_INVALID";
    readonly NOT_FOUND: "PROVENANCE_NOT_FOUND";
    readonly CHAIN_BROKEN: "PROVENANCE_CHAIN_BROKEN";
    readonly ROOT_NOT_FOUND: "ROOT_DOCUMENT_NOT_FOUND";
    readonly INVALID_TYPE: "INVALID_PROVENANCE_TYPE";
    readonly INVALID_PARAMS: "INVALID_PROVENANCE_PARAMS";
};
type VerifierErrorCodeType = (typeof VerifierErrorCode)[keyof typeof VerifierErrorCode];
/**
 * VerifierError - Typed error for verification operations
 * FAIL FAST: Always throw with detailed error information
 */
export declare class VerifierError extends Error {
    readonly code: VerifierErrorCodeType;
    readonly details?: Record<string, unknown> | undefined;
    constructor(message: string, code: VerifierErrorCodeType, details?: Record<string, unknown> | undefined);
}
/** Result of single item verification */
interface ItemVerificationResult {
    valid: boolean;
    item_id: string;
    item_type: ProvenanceType;
    expected_hash: string;
    computed_hash: string;
    format_valid: boolean;
    verified_at: string;
}
/** Result of chain verification */
interface ChainVerificationResult extends VerificationResult {
    start_id: string;
    chain_depth: number;
    root_document_id: string;
    chain_length: number;
}
/** Result of database-wide verification */
interface DatabaseVerificationResult extends VerificationResult {
    database_name: string;
    documents_verified: number;
    ocr_results_verified: number;
    chunks_verified: number;
    embeddings_verified: number;
    images_verified: number;
    vlm_descriptions_verified: number;
    duration_ms: number;
    /** Number of failed items beyond the MAX_FAILED_ITEMS cap (H-6) */
    failed_overflow: number;
    /** Chain integrity errors (missing parents, depth mismatches) */
    chain_errors?: string[];
}
/**
 * ProvenanceVerifier - Hash integrity and chain verification
 *
 * Provides verification for:
 * 1. Single provenance record content hash
 * 2. Complete provenance chain integrity
 * 3. Database-wide verification
 * 4. Source file integrity
 */
export declare class ProvenanceVerifier {
    private readonly db;
    private readonly tracker;
    private readonly rawDb;
    constructor(db: DatabaseService, tracker: ProvenanceTracker);
    /**
     * Verify content hash for a single provenance record
     *
     * @param provenanceId - Provenance record ID to verify
     * @returns Verification result with computed and expected hashes
     * @throws VerifierError if provenance not found, content not found, or file not accessible
     */
    verifyContentHash(provenanceId: string): Promise<ItemVerificationResult>;
    /**
     * Verify complete provenance chain from item to root
     *
     * @param provenanceId - Starting provenance record ID
     * @returns Chain verification result with all failing items
     * @throws VerifierError if chain broken or item not found
     */
    verifyChain(provenanceId: string): Promise<ChainVerificationResult>;
    /**
     * Verify all provenance records in database
     *
     * @returns Database verification result with counts by type
     */
    verifyDatabase(): Promise<DatabaseVerificationResult>;
    /**
     * Verify source file still matches stored hash
     *
     * @param documentId - Document ID to verify
     * @returns Verification result for the file
     * @throws VerifierError if document not found or file not accessible
     */
    verifyFileIntegrity(documentId: string): Promise<ItemVerificationResult>;
    /**
     * Get content and expected hash for a provenance record
     * Returns { content, expectedHash, isFile } or throws if content not found
     *
     * CRITICAL MAPPING:
     * - DOCUMENT: file_path → file_hash (via hashFile)
     * - OCR_RESULT: extracted_text → content_hash
     * - CHUNK: text → text_hash
     * - EMBEDDING: original_text → content_hash
     */
    private getContentForVerification;
    /**
     * Get document by its provenance_id
     */
    private getDocumentByProvenanceId;
    /**
     * Get OCR result by its provenance_id
     */
    private getOCRResultByProvenanceId;
    /**
     * Get chunk by its provenance_id
     */
    private getChunkByProvenanceId;
    /**
     * Get embedding by its provenance_id (without vector)
     */
    private getEmbeddingByProvenanceId;
    /**
     * Get image by its provenance_id
     */
    private getImageByProvenanceId;
    /**
     * Get all provenance records ordered by chain_depth
     */
    private getAllProvenance;
    /**
     * Get database name from metadata
     */
    private getDatabaseName;
}
export {};
//# sourceMappingURL=verifier.d.ts.map