import type { Db } from "@paperclipai/db";
import { selectorToAnchorSnapshot, type DocumentAnnotationAnchorSnapshot, type DocumentAnnotationComment, type DocumentAnnotationThread, CreateDocumentAnnotationComment, CreateDocumentAnnotationThread, UpdateDocumentAnnotationThread } from "@paperclipai/shared";
type ActorInput = {
    actorType: "agent" | "user";
    actorId: string;
    agentId?: string | null;
    userId?: string | null;
    runId?: string | null;
};
export declare function documentAnnotationService(db: Db): {
    listThreadsForIssueDocument: (issueId: string, key: string, options?: {
        status?: "open" | "resolved" | "all";
        includeComments?: boolean;
    }) => Promise<DocumentAnnotationThread[]>;
    getThreadForIssueDocument: (issueId: string, key: string, threadId: string) => Promise<{
        comments: DocumentAnnotationComment[];
        id: string;
        companyId: string;
        issueId: string;
        documentId: string;
        documentKey: string;
        status: import("@paperclipai/shared").DocumentAnnotationThreadStatus;
        anchorState: import("@paperclipai/shared").DocumentAnnotationAnchorState;
        anchorConfidence: import("@paperclipai/shared").DocumentAnnotationAnchorConfidence;
        originalRevisionId: string | null;
        originalRevisionNumber: number;
        currentRevisionId: string | null;
        currentRevisionNumber: number;
        selectedText: string;
        prefixText: string;
        suffixText: string;
        normalizedStart: number;
        normalizedEnd: number;
        markdownStart: number;
        markdownEnd: number;
        anchorSelector: import("@paperclipai/shared").DocumentAnnotationAnchorSelector;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        resolvedByAgentId: string | null;
        resolvedByUserId: string | null;
        resolvedAt: Date | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
    createThread: (issueId: string, key: string, input: CreateDocumentAnnotationThread, actor: ActorInput) => Promise<{
        comments: {
            id: string;
            companyId: string;
            threadId: string;
            issueId: string;
            documentId: string;
            body: string;
            authorType: "user" | "agent" | "system";
            authorAgentId: string | null;
            authorUserId: string | null;
            createdByRunId: string | null;
            issueCommentId: string | null;
            createdAt: Date;
            updatedAt: Date;
        }[];
        id: string;
        companyId: string;
        issueId: string;
        documentId: string;
        documentKey: string;
        status: "resolved" | "open";
        anchorState: "active" | "stale" | "orphaned";
        anchorConfidence: "exact" | "duplicate" | "fuzzy" | "ambiguous" | "missing";
        originalRevisionId: string | null;
        originalRevisionNumber: number;
        currentRevisionId: string | null;
        currentRevisionNumber: number;
        selectedText: string;
        prefixText: string;
        suffixText: string;
        normalizedStart: number;
        normalizedEnd: number;
        markdownStart: number;
        markdownEnd: number;
        anchorSelector: import("@paperclipai/shared").DocumentAnnotationAnchorSelector;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        resolvedByAgentId: string | null;
        resolvedByUserId: string | null;
        resolvedAt: Date | null;
        createdAt: Date;
        updatedAt: Date;
    }>;
    addComment: (issueId: string, key: string, threadId: string, input: CreateDocumentAnnotationComment, actor: ActorInput) => Promise<{
        id: string;
        companyId: string;
        threadId: string;
        issueId: string;
        documentId: string;
        body: string;
        authorType: "user" | "agent" | "system";
        authorAgentId: string | null;
        authorUserId: string | null;
        createdByRunId: string | null;
        issueCommentId: string | null;
        createdAt: Date;
        updatedAt: Date;
    }>;
    cleanupForIssueCommentDeletion: (issueId: string, issueCommentId: string, actor: ActorInput, dbOrTx?: any) => Promise<{
        deletedCommentIds: string[];
        resolvedThreadIds: string[];
    }>;
    updateThread: (issueId: string, key: string, threadId: string, input: UpdateDocumentAnnotationThread, actor: ActorInput) => Promise<DocumentAnnotationThread>;
    remapOpenThreadsForDocument: (input: {
        issueId: string;
        key: string;
        documentId: string;
        nextRevisionId: string | null;
        nextRevisionNumber: number;
        nextBody: string;
    }) => Promise<{
        thread: {
            id: string;
            companyId: string;
            issueId: string;
            documentId: string;
            documentKey: string;
            status: "resolved" | "open";
            anchorState: "active" | "stale" | "orphaned";
            anchorConfidence: "exact" | "duplicate" | "fuzzy" | "ambiguous" | "missing";
            originalRevisionId: string | null;
            originalRevisionNumber: number;
            currentRevisionId: string | null;
            currentRevisionNumber: number;
            selectedText: string;
            prefixText: string;
            suffixText: string;
            normalizedStart: number;
            normalizedEnd: number;
            markdownStart: number;
            markdownEnd: number;
            anchorSelector: import("@paperclipai/shared").DocumentAnnotationAnchorSelector;
            createdByAgentId: string | null;
            createdByUserId: string | null;
            resolvedByAgentId: string | null;
            resolvedByUserId: string | null;
            resolvedAt: Date | null;
            createdAt: Date;
            updatedAt: Date;
        };
        snapshot: {
            id: string;
            createdAt: Date;
            companyId: string;
            documentId: string;
            failureReason: string | null;
            anchorState: "active" | "stale" | "orphaned";
            anchorConfidence: "exact" | "duplicate" | "fuzzy" | "ambiguous" | "missing";
            threadId: string;
            fromRevisionId: string | null;
            fromRevisionNumber: number | null;
            toRevisionId: string | null;
            toRevisionNumber: number;
            previousAnchor: DocumentAnnotationAnchorSnapshot;
            nextAnchor: DocumentAnnotationAnchorSnapshot | null;
        };
    }[]>;
    selectorToAnchorSnapshot: typeof selectorToAnchorSnapshot;
};
export {};
//# sourceMappingURL=document-annotations.d.ts.map