/**
 * Annotation Database Operations
 *
 * CRUD operations for document annotations with threading support.
 * Annotations can be attached to documents or specific chunks, with
 * optional page numbers and threaded replies via parent_id.
 *
 * CRITICAL: NEVER use console.log() - stdout is reserved for JSON-RPC protocol.
 *
 * @module database/annotation-operations
 */
import type Database from 'better-sqlite3';
export interface CreateAnnotationParams {
    document_id: string;
    user_id?: string | null;
    chunk_id?: string | null;
    page_number?: number | null;
    annotation_type: string;
    content: string;
    parent_id?: string | null;
}
export interface AnnotationRow {
    id: string;
    document_id: string;
    user_id: string | null;
    chunk_id: string | null;
    page_number: number | null;
    annotation_type: string;
    content: string;
    status: string;
    parent_id: string | null;
    created_at: string;
    updated_at: string;
}
export interface ListAnnotationsOptions {
    document_id: string;
    annotation_type?: string;
    status?: string;
    user_id?: string;
    page_number?: number;
    limit?: number;
    offset?: number;
}
/**
 * Create a new annotation on a document or chunk.
 *
 * @param conn - Database connection
 * @param params - Annotation creation parameters
 * @returns The created annotation row
 * @throws Error if document, chunk, or parent annotation not found
 */
export declare function createAnnotation(conn: Database.Database, params: CreateAnnotationParams): AnnotationRow;
/**
 * Get an annotation by ID.
 *
 * @param conn - Database connection
 * @param id - Annotation ID
 * @returns The annotation row or null if not found
 */
export declare function getAnnotation(conn: Database.Database, id: string): AnnotationRow | null;
/**
 * Get an annotation with its threaded replies.
 *
 * @param conn - Database connection
 * @param id - Annotation ID
 * @returns The annotation and its replies, or null if not found
 */
export declare function getAnnotationWithThread(conn: Database.Database, id: string): {
    annotation: AnnotationRow;
    replies: AnnotationRow[];
} | null;
/**
 * List annotations for a document with optional filters.
 *
 * @param conn - Database connection
 * @param opts - Filter and pagination options
 * @returns Paginated annotations and total count
 */
export declare function listAnnotations(conn: Database.Database, opts: ListAnnotationsOptions): {
    annotations: AnnotationRow[];
    total: number;
};
/**
 * Update an annotation's content and/or status.
 *
 * @param conn - Database connection
 * @param id - Annotation ID
 * @param updates - Fields to update (content and/or status)
 * @returns The updated annotation row
 * @throws Error if annotation not found
 */
export declare function updateAnnotation(conn: Database.Database, id: string, updates: {
    content?: string;
    status?: string;
}): AnnotationRow;
/**
 * Delete an annotation by ID.
 * Child annotations (replies) are cascade-deleted by the FK constraint.
 *
 * @param conn - Database connection
 * @param id - Annotation ID
 * @throws Error if annotation not found
 */
export declare function deleteAnnotation(conn: Database.Database, id: string): void;
/**
 * Get annotation summary statistics for a document.
 *
 * @param conn - Database connection
 * @param documentId - Document ID
 * @returns Summary with counts by type, status, and totals
 */
export declare function getAnnotationSummary(conn: Database.Database, documentId: string): Record<string, unknown>;
//# sourceMappingURL=annotation-operations.d.ts.map