import Database from "better-sqlite3";
import type { CreatePhaseNoteInput, CreatePhaseNoteResult, ListPhaseNotesBatchFilter, ListPhaseNotesFilter, PhaseNoteRow, PhaseNoteTaskSuggestionRow, UpdateActivePhaseNotePatch } from "./phase-journal-types.js";
type SqliteDb = InstanceType<typeof Database>;
export declare function phaseNoteTaskSuggestionsTableExists(db: SqliteDb): boolean;
/**
 * Insert one phase note (+ refs). Caller supplies an outer transaction when needed.
 * Idempotent when `idempotencyKey` matches an existing row (same as {@link PhaseJournalStore#createNoteIdempotent}).
 */
export declare function insertPhaseNoteInConnection(db: SqliteDb, input: CreatePhaseNoteInput): CreatePhaseNoteResult;
/**
 * Mark a single active phase note as converted, linking `converted_task_id`.
 * Returns whether exactly one row was updated.
 */
export declare function markPhaseNoteConvertedInConnection(db: SqliteDb, noteId: string, convertedTaskId: string, eligibleNoteTypes: readonly string[]): boolean;
export declare function deletePhaseNoteTaskSuggestionsForNoteId(db: SqliteDb, noteId: string): void;
/** Upsert one suggestion row per phase note (bounded caller). */
export declare function upsertPhaseNoteTaskSuggestionFromNote(db: SqliteDb, note: PhaseNoteRow): PhaseNoteTaskSuggestionRow;
export declare function markPhaseNoteTaskSuggestionsConvertedInConnection(db: SqliteDb, noteId: string, convertedTaskId: string, suggestionId?: string): void;
export declare class PhaseJournalStore {
    private readonly db;
    constructor(db: SqliteDb);
    getById(noteId: string): PhaseNoteRow | null;
    /**
     * Insert a note and refs, or return the existing row when `idempotencyKey` matches.
     */
    createNoteIdempotent(input: CreatePhaseNoteInput): CreatePhaseNoteResult;
    listNotes(filter: ListPhaseNotesFilter): PhaseNoteRow[];
    /**
     * One round-trip for many phases (dashboard past-phase rollup). Applies {@link ListPhaseNotesBatchFilter.limitPerPhase}
     * per phase after ordering by `created_at` descending.
     */
    listNotesGroupedByPhaseKeys(filter: ListPhaseNotesBatchFilter): Map<string, PhaseNoteRow[]>;
    dismissNote(noteId: string): PhaseNoteRow | null;
    supersedeNote(fromNoteId: string, supersededByNoteId: string): PhaseNoteRow | null;
    /**
     * Update summary/details/expires_at on an **active** note. Preserves idempotency_key, source_command,
     * author/session provenance. Stamps `planning_generation` + `updated_at` from caller.
     */
    updateActivePhaseNote(noteId: string, patch: UpdateActivePhaseNotePatch, audit: {
        planningGeneration: number | null;
        updatedAt: string;
    }): PhaseNoteRow | null;
}
export declare function createPhaseJournalStore(db: SqliteDb): PhaseJournalStore;
export {};
