/**
 * Image operations for DatabaseService
 *
 * Handles all CRUD operations for extracted images including
 * insert, get, list, update VLM results, and delete.
 */
import Database from 'better-sqlite3';
import { ImageReference, CreateImageReference, VLMResult, ImageStats } from '../../../models/image.js';
import { ListImagesOptions } from './types.js';
/**
 * Insert a new image reference
 *
 * @param db - Database connection
 * @param image - Image data (id and timestamps will be generated)
 * @returns ImageReference - The created image with generated fields
 */
export declare function insertImage(db: Database.Database, image: CreateImageReference): ImageReference;
/**
 * Insert multiple images in a batch
 *
 * @param db - Database connection
 * @param images - Array of image data to insert
 * @returns ImageReference[] - Array of created images
 */
export declare function insertImageBatch(db: Database.Database, images: CreateImageReference[]): ImageReference[];
/**
 * Get an image by ID
 *
 * @param db - Database connection
 * @param id - Image ID
 * @returns ImageReference | null - The image or null if not found
 */
export declare function getImage(db: Database.Database, id: string): ImageReference | null;
/**
 * Get images for a document with optional filtering
 *
 * @param db - Database connection
 * @param documentId - Document ID
 * @param options - Optional filters: vlmStatus, limit
 * @returns ImageReference[] - Array of images ordered by page and index
 */
export declare function getImagesByDocument(db: Database.Database, documentId: string, options?: {
    vlmStatus?: string;
    limit?: number;
}): ImageReference[];
/**
 * Get all images for an OCR result
 *
 * @param db - Database connection
 * @param ocrResultId - OCR result ID
 * @returns ImageReference[] - Array of images ordered by page and index
 */
export declare function getImagesByOCRResult(db: Database.Database, ocrResultId: string): ImageReference[];
/**
 * Get pending images for VLM processing
 *
 * @param db - Database connection
 * @param limit - Maximum number of images to return
 * @returns ImageReference[] - Array of pending images ordered by creation time
 */
export declare function getPendingImages(db: Database.Database, limit?: number): ImageReference[];
/**
 * List images with optional filtering
 *
 * @param db - Database connection
 * @param options - Optional filter options
 * @returns ImageReference[] - Array of images
 */
export declare function listImages(db: Database.Database, options?: ListImagesOptions): ImageReference[];
/**
 * Update image VLM status to processing
 *
 * @param db - Database connection
 * @param id - Image ID
 */
export declare function setImageProcessing(db: Database.Database, id: string): boolean;
/**
 * Update image with VLM results
 *
 * @param db - Database connection
 * @param id - Image ID
 * @param result - VLM processing result
 */
export declare function updateImageVLMResult(db: Database.Database, id: string, result: VLMResult): void;
/**
 * Mark image as complete but intentionally skipped by relevance filtering.
 * Sets vlm_status='complete' with vlm_description=NULL so the image
 * is not reprocessed by retry_failed, does not inflate failure counts,
 * and is not incorrectly counted as having a VLM description.
 * The skip reason is stored in error_message for diagnostics.
 *
 * @param db - Database connection
 * @param id - Image ID
 * @param skipReason - Reason the image was skipped (stored in error_message for diagnostics)
 */
export declare function setImageVLMSkipped(db: Database.Database, id: string, skipReason: string): void;
/**
 * Mark image VLM processing as failed
 *
 * @param db - Database connection
 * @param id - Image ID
 * @param errorMessage - Error message
 */
export declare function setImageVLMFailed(db: Database.Database, id: string, errorMessage: string): void;
/**
 * Update image context text
 *
 * @param db - Database connection
 * @param id - Image ID
 * @param contextText - Surrounding text from document
 */
export declare function updateImageContext(db: Database.Database, id: string, contextText: string): void;
/**
 * Update image provenance_id
 *
 * @param db - Database connection
 * @param id - Image ID
 * @param provenanceId - Provenance record ID to set
 */
export declare function updateImageProvenance(db: Database.Database, id: string, provenanceId: string): void;
/**
 * Get image statistics
 *
 * @param db - Database connection
 * @returns ImageStats - Statistics about images in database
 */
export declare function getImageStats(db: Database.Database): ImageStats;
/**
 * Delete an image by ID
 *
 * @param db - Database connection
 * @param id - Image ID
 * @returns boolean - True if image was deleted
 */
export declare function deleteImage(db: Database.Database, id: string): boolean;
/**
 * Delete an image and all its derived data (embeddings, vectors, provenance).
 * Performs a full cascade deletion to prevent orphaned records.
 *
 * @param db - Database connection
 * @param imageId - Image ID to delete
 */
export declare function deleteImageCascade(db: Database.Database, imageId: string): void;
/**
 * Delete all images for a document and all their derived data (embeddings, vectors, provenance).
 * Performs a full cascade deletion to prevent orphaned records.
 *
 * @param db - Database connection
 * @param documentId - Document ID
 * @returns number - Number of images deleted
 */
export declare function deleteImagesByDocumentCascade(db: Database.Database, documentId: string): number;
/**
 * Delete all images for a document
 *
 * @param db - Database connection
 * @param documentId - Document ID
 * @returns number - Number of images deleted
 */
export declare function deleteImagesByDocument(db: Database.Database, documentId: string): number;
/**
 * Count images by document
 *
 * @param db - Database connection
 * @param documentId - Document ID
 * @returns number - Number of images for this document
 */
export declare function countImagesByDocument(db: Database.Database, documentId: string): number;
/**
 * Reset VLM status to pending for failed images
 *
 * @param db - Database connection
 * @param documentId - Optional document ID to filter
 * @returns number - Number of images reset
 */
export declare function resetFailedImages(db: Database.Database, documentId?: string): number;
/**
 * Reset VLM status to pending for images stuck in 'processing' state
 *
 * @param db - Database connection
 * @param documentId - Optional document ID to filter
 * @returns number - Number of images reset
 */
export declare function resetProcessingImages(db: Database.Database, documentId?: string): number;
/**
 * Find a VLM-complete image with the same content hash (for deduplication).
 * Returns the first matching image or null.
 *
 * @param db - Database connection
 * @param contentHash - SHA-256 hash to search for
 * @param excludeId - Optional image ID to exclude from results
 * @returns ImageReference | null
 */
export declare function findByContentHash(db: Database.Database, contentHash: string, excludeId?: string): ImageReference | null;
/**
 * Copy VLM results from one image to another (deduplication).
 * Sets vlm_status='complete', vlm_tokens_used=0 (no API call made).
 *
 * @param db - Database connection
 * @param targetId - Image ID to copy results TO
 * @param source - Source image to copy results FROM
 */
export declare function copyVLMResult(db: Database.Database, targetId: string, source: ImageReference): void;
//# sourceMappingURL=image-operations.d.ts.map