/**
 * Types for history management system
 */
import type { WritableAtom } from 'jotai';
export interface HistoryEntry {
    id: string;
    diff: unknown;
    timestamp: number;
    fullValue?: unknown;
}
export interface HistoryStack {
    past: HistoryEntry[];
    future: HistoryEntry[];
}
export interface AtomWithHistory<Value> extends WritableAtom<Value, [Value], void> {
    id: string;
}
export interface GroupHistoryOperation {
    type: 'group';
    operations: HistoryEntry[];
}
export interface AtomWithHistoryOptions<Value> {
    id?: string;
    historyLimit?: number;
    shouldTrack?: (prev: Value, next: Value) => boolean;
    customDiff?: (prev: Value, next: Value) => unknown;
    customPatch?: (value: Value, diff: unknown) => Value;
    useFullValueInstead?: boolean;
}
export interface HistoryActions {
    undo: () => void;
    redo: () => void;
    canUndo: boolean;
    canRedo: boolean;
    clear: () => void;
    groupOperations: (callback: () => void) => void;
}
export interface ObjectDiff {
    type: 'object';
    changed: Record<string, unknown>;
    added: Record<string, unknown>;
    deleted: string[];
}
export interface ArrayDiff {
    type: 'array';
    items: Array<{
        index: number;
        value?: unknown;
        removed?: boolean;
        added?: boolean;
    }>;
}
export interface ValueDiff {
    type: 'value';
    before: unknown;
    after: unknown;
}
export type Diff = ObjectDiff | ArrayDiff | ValueDiff;
