import type { IndexingJobError, IndexingJobRecord, IndexingJobStatus, KnowledgeCapsuleId, KnowledgeSourceId } from "@oscharko-dev/keiko-contracts";
import type { DatabaseSync } from "node:sqlite";
export interface IndexingJobRow {
    readonly id: string;
    readonly capsule_id: string;
    readonly source_ids_json: string;
    readonly started_at: number;
    readonly finished_at: number | null;
    readonly status: string;
    readonly total_documents: number;
    readonly processed_documents: number;
    readonly failed_documents: number;
    readonly skipped_documents: number;
    readonly last_error_code: string | null;
    readonly last_error_message: string | null;
    readonly resume_token: string | null;
    readonly cancellation_requested: number;
}
export interface InsertJobInput {
    readonly id: string;
    readonly capsuleId: KnowledgeCapsuleId;
    readonly sourceIds: readonly KnowledgeSourceId[];
    readonly startedAt: number;
}
export declare function insertJobRow(db: DatabaseSync, input: InsertJobInput): void;
export interface JobCounters {
    readonly total: number;
    readonly processed: number;
    readonly failed: number;
    readonly skipped: number;
    readonly resumeToken: string | null;
}
export declare function updateJobCounters(db: DatabaseSync, id: string, counters: JobCounters): void;
export interface FinalizeJobInput {
    readonly id: string;
    readonly status: IndexingJobStatus;
    readonly finishedAt: number;
    readonly counters: JobCounters;
    readonly lastError?: IndexingJobError;
}
export declare function finalizeJobRow(db: DatabaseSync, input: FinalizeJobInput): void;
export declare function selectRunningJobByCapsule(db: DatabaseSync, capsuleId: KnowledgeCapsuleId): IndexingJobRow | undefined;
export declare function selectJobById(db: DatabaseSync, id: string): IndexingJobRow | undefined;
export declare function isJobCancellationRequested(db: DatabaseSync, id: string): boolean;
export declare function rowToIndexingJobRecord(row: IndexingJobRow): IndexingJobRecord;
//# sourceMappingURL=job-persist.d.ts.map