/**
 * Cluster operations for DatabaseService
 *
 * Handles CRUD operations for the clusters and document_clusters tables.
 */
import Database from 'better-sqlite3';
import type { Cluster, DocumentCluster } from '../../../models/cluster.js';
/**
 * Insert a cluster record
 */
export declare function insertCluster(db: Database.Database, cluster: Cluster): string;
/**
 * Get a cluster by ID
 */
export declare function getCluster(db: Database.Database, id: string): Cluster | null;
/**
 * List clusters with optional filters and pagination
 */
export declare function listClusters(db: Database.Database, options?: {
    run_id?: string;
    classification_tag?: string;
    limit?: number;
    offset?: number;
}): Cluster[];
/**
 * Delete all clusters and their document assignments for a run.
 * First deletes document_clusters, then clusters.
 * Returns the number of clusters deleted.
 */
export declare function deleteClustersByRunId(db: Database.Database, runId: string): number;
/**
 * Insert a document-cluster assignment
 */
export declare function insertDocumentCluster(db: Database.Database, dc: DocumentCluster): string;
/**
 * Get all documents in a cluster, joined with documents for file_name
 */
export declare function getClusterDocuments(db: Database.Database, clusterId: string): Array<{
    document_id: string;
    file_name: string;
    similarity_to_centroid: number;
    membership_probability: number;
}>;
/**
 * Lightweight cluster summary (excludes large JSON fields)
 */
interface ClusterSummary {
    id: string;
    run_id: string;
    cluster_index: number;
    label: string | null;
    classification_tag: string | null;
    document_count: number;
    coherence_score: number | null;
    created_at: string;
}
/**
 * Get cluster summaries for a run (lightweight: no JSON blobs)
 */
export declare function getClusterSummariesByRunId(db: Database.Database, runId: string): ClusterSummary[];
/**
 * Get cluster summaries for a document (via document_clusters join)
 */
export declare function getClusterSummariesForDocument(db: Database.Database, documentId: string): ClusterSummary[];
/**
 * Reassign a document from its current cluster to a different target cluster.
 * Deletes existing document_clusters entries for this document within the same run,
 * inserts a new assignment, and updates member_count on both old and new clusters.
 *
 * @returns Object with old_cluster_id (null if not previously assigned) and run_id
 */
export declare function reassignDocument(db: Database.Database, documentId: string, targetClusterId: string): {
    old_cluster_id: string | null;
    run_id: string;
};
/**
 * Merge two clusters into one. All documents from cluster2 are moved to cluster1.
 * cluster2 is deleted after the merge.
 *
 * Both clusters must belong to the same run_id.
 *
 * @returns Object with merged_cluster_id and documents_moved count
 */
export declare function mergeClusters(db: Database.Database, clusterId1: string, clusterId2: string): {
    merged_cluster_id: string;
    documents_moved: number;
};
/**
 * Get aggregate clustering statistics
 */
export declare function getClusteringStats(db: Database.Database): {
    total_clusters: number;
    total_runs: number;
    avg_coherence: number | null;
};
export {};
//# sourceMappingURL=cluster-operations.d.ts.map