import { type KbDocument } from "../schema";
export interface UpsertKbDocumentInput {
    crawlJobId: string;
    url: string;
    title: string;
    content: string;
    fetchedAt: Date;
}
/** Upserts on the existing (tenantId, url) unique index -- resubmitting a URL edits the existing entry. */
export declare function upsertKbDocument(tenantId: string, input: UpsertKbDocumentInput): Promise<KbDocument>;
export interface CreateManualKbDocumentInput {
    title: string;
    content: string;
}
/**
 * Inserts an admin-authored knowledge entry that has no source page. url and
 * crawlJobId are left null (source = 'manual'); unlike crawled pages there is no
 * (tenantId, url) upsert -- each save is a fresh entry, edited/removed by id.
 */
export declare function createManualKbDocument(tenantId: string, input: CreateManualKbDocumentInput): Promise<KbDocument>;
export interface CreateUploadKbDocumentInput {
    title: string;
    content: string;
}
/**
 * Inserts an entry sourced from an uploaded file's extracted text. Like manual
 * entries, url and crawlJobId are left null (source = 'upload') and there is no
 * (tenantId, url) upsert -- each save is a fresh entry, edited/removed by id.
 */
export declare function createUploadKbDocument(tenantId: string, input: CreateUploadKbDocumentInput): Promise<KbDocument>;
export declare function listKbDocuments(tenantId: string): Promise<KbDocument[]>;
/** Tenant-scoped count -- avoids hauling full document content just to size the set. */
export declare function countKbDocuments(tenantId: string): Promise<number>;
/** Tenant-scoped lookup -- returns null if the document belongs to a different tenant. */
export declare function getKbDocument(tenantId: string, id: string): Promise<KbDocument | null>;
/** Tenant-scoped delete -- returns the deleted row, or null if it didn't belong to this tenant. */
export declare function deleteKbDocument(tenantId: string, id: string): Promise<KbDocument | null>;
