/**
 * DatabaseService class for all database operations
 *
 * Provides CRUD operations for documents, OCR results, chunks, embeddings,
 * and provenance records. Uses prepared statements for security and performance.
 */
import Database from 'better-sqlite3';
import { Document, DocumentStatus, OCRResult } from '../../../models/document.js';
import { Chunk } from '../../../models/chunk.js';
import { Embedding } from '../../../models/embedding.js';
import { ProvenanceRecord } from '../../../models/provenance.js';
import { DatabaseInfo, DatabaseStats, ListDocumentsOptions } from './types.js';
import type { TimelineStatsOptions, TimelineDataPoint, QualityTrendOptions, QualityTrendDataPoint, ThroughputOptions, ThroughputDataPoint } from './stats-operations.js';
import type { ChunkFilterOptions } from './chunk-operations.js';
import * as embOps from './embedding-operations.js';
import * as provOps from './provenance-operations.js';
import type { Tag, TagWithCount, EntityTagResult } from './tag-operations.js';
import type { Extraction } from '../../../models/extraction.js';
import type { FormFill } from '../../../models/form-fill.js';
/**
 * DatabaseService class for all database operations
 */
export declare class DatabaseService {
    private db;
    private readonly name;
    private readonly path;
    private constructor();
    static create(name: string, description?: string, storagePath?: string): DatabaseService;
    static open(name: string, storagePath?: string): DatabaseService;
    static list(storagePath?: string): DatabaseInfo[];
    static delete(name: string, storagePath?: string): void;
    static exists(name: string, storagePath?: string): boolean;
    getStats(): DatabaseStats;
    close(): void;
    getName(): string;
    getPath(): string;
    transaction<T>(fn: () => T): T;
    getConnection(): Database.Database;
    insertDocument(doc: Omit<Document, 'created_at'>): string;
    getDocument(id: string): Document | null;
    getDocumentByPath(filePath: string): Document | null;
    getDocumentByHash(fileHash: string): Document | null;
    listDocuments(options?: ListDocumentsOptions): Document[];
    updateDocumentStatus(id: string, status: DocumentStatus, errorMessage?: string): void;
    updateDocumentOCRComplete(id: string, pageCount: number, ocrCompletedAt: string): void;
    deleteDocument(id: string): void;
    cleanDocumentDerivedData(id: string): void;
    insertOCRResult(result: OCRResult): string;
    getOCRResult(id: string): OCRResult | null;
    getOCRResultByDocumentId(documentId: string): OCRResult | null;
    insertChunk(chunk: Omit<Chunk, 'created_at' | 'embedding_status' | 'embedded_at'>): string;
    insertChunks(chunks: Omit<Chunk, 'created_at' | 'embedding_status' | 'embedded_at'>[]): string[];
    getChunk(id: string): Chunk | null;
    hasChunksByDocumentId(documentId: string): boolean;
    getChunksByDocumentId(documentId: string): Chunk[];
    getChunksByOCRResultId(ocrResultId: string): Chunk[];
    getPendingEmbeddingChunks(limit?: number): Chunk[];
    updateChunkEmbeddingStatus(id: string, status: 'pending' | 'complete' | 'failed', embeddedAt?: string): void;
    getChunksFiltered(documentId: string, filters: ChunkFilterOptions): {
        chunks: Chunk[];
        total: number;
    };
    getChunkNeighbors(documentId: string, chunkIndex: number, count: number): Chunk[];
    insertEmbedding(embedding: Omit<Embedding, 'created_at' | 'vector'>): string;
    insertEmbeddings(embeddings: Omit<Embedding, 'created_at' | 'vector'>[]): string[];
    getEmbedding(id: string): Omit<Embedding, 'vector'> | null;
    getEmbeddingByChunkId(chunkId: string): Omit<Embedding, 'vector'> | null;
    getEmbeddingByExtractionId(extractionId: string): Omit<Embedding, 'vector'> | null;
    getEmbeddingsByDocumentId(documentId: string): Omit<Embedding, 'vector'>[];
    getEmbeddingsFiltered(filters: embOps.EmbeddingFilterOptions): {
        embeddings: Array<Omit<Embedding, 'vector'>>;
        total: number;
    };
    getEmbeddingStats(documentId?: string): embOps.EmbeddingStatsResult;
    deleteEmbeddingsByChunkId(chunkId: string): number;
    deleteEmbeddingsByImageId(imageId: string): number;
    deleteEmbeddingsByDocumentId(documentId: string): number;
    insertProvenance(record: ProvenanceRecord): string;
    getProvenance(id: string): ProvenanceRecord | null;
    getProvenanceChain(id: string): ProvenanceRecord[];
    getProvenanceByRootDocument(rootDocumentId: string): ProvenanceRecord[];
    getProvenanceChildren(parentId: string): ProvenanceRecord[];
    queryProvenance(filters: provOps.ProvenanceQueryFilters): {
        records: ProvenanceRecord[];
        total: number;
    };
    getProvenanceProcessorStats(filters?: {
        processor?: string;
        created_after?: string;
        created_before?: string;
    }): provOps.ProvenanceProcessorStat[];
    insertExtraction(extraction: Extraction): string;
    getExtractionsByDocument(documentId: string): Extraction[];
    getExtraction(id: string): Extraction | null;
    searchExtractions(query: string, filters?: {
        document_filter?: string[];
        limit?: number;
    }): Extraction[];
    insertFormFill(formFill: FormFill): string;
    getFormFill(id: string): FormFill | null;
    listFormFills(options?: {
        status?: string;
        limit?: number;
        offset?: number;
    }): FormFill[];
    searchFormFills(query: string, options?: {
        limit?: number;
        offset?: number;
    }): FormFill[];
    deleteFormFill(id: string): boolean;
    updateDocumentMetadata(id: string, metadata: {
        docTitle?: string | null;
        docAuthor?: string | null;
        docSubject?: string | null;
    }): void;
    getTimelineStats(options: TimelineStatsOptions): TimelineDataPoint[];
    getQualityTrends(options: QualityTrendOptions): QualityTrendDataPoint[];
    getThroughputAnalytics(options: ThroughputOptions): ThroughputDataPoint[];
    reassignDocument(documentId: string, targetClusterId: string): {
        old_cluster_id: string | null;
        run_id: string;
    };
    mergeClusters(clusterId1: string, clusterId2: string): {
        merged_cluster_id: string;
        documents_moved: number;
    };
    updateImageProvenance(id: string, provenanceId: string): void;
    createTag(tag: {
        name: string;
        description?: string;
        color?: string;
    }): Tag;
    getTagByName(name: string): Tag | null;
    getAllTags(): Tag[];
    getTagsWithCounts(): TagWithCount[];
    applyTag(tagId: string, entityId: string, entityType: string): string;
    removeTag(tagId: string, entityId: string, entityType: string): boolean;
    getTagsForEntity(entityId: string, entityType: string): Tag[];
    searchByTags(tagNames: string[], entityType?: string, matchAll?: boolean): EntityTagResult[];
    deleteTag(tagId: string): number;
}
//# sourceMappingURL=service.d.ts.map