import { RegistryInterface } from '@subscan/widget-runtime';
import { AppModel } from '../AppModel/AppModel';
export declare const leafSymbol: unique symbol;
export declare const branchSymbol: unique symbol;
export declare class OperationList<TOperation extends IOperation = IOperation> {
    private readonly head;
    private _cursor;
    get cursor(): ListNode<TOperation | null>;
    constructor();
    insert(value: TOperation): ListNode<TOperation | null, TOperation | null, TOperation | null>;
    moveNext(): ListNode<TOperation | null, TOperation | null, TOperation | null>;
    movePrev(): ListNode<TOperation | null, TOperation | null, TOperation | null>;
    reduce<TData>(cb: (prev: TData, node: TOperation) => TData, initialData: TData): TData;
    reduceRight<TData>(cb: (prev: TData, node: TOperation) => TData, initialData: TData): TData;
}
export declare class ListNode<T, TPrev = T, TNext = T> {
    val: T;
    prev: ListNode<TPrev> | null;
    next: ListNode<TNext> | null;
    constructor(val: T, prev?: ListNode<TPrev> | null, next?: ListNode<TNext> | null);
}
export interface IUndoRedo {
    do(...args: any[]): any;
    redo(...args: any[]): any;
    undo(...args: any[]): any;
}
export interface IUndoRedoManager extends IUndoRedo {
    operationStack: OperationList;
}
export interface IOperation<TContext = any> extends IUndoRedo {
    context: TContext;
    type: symbol;
    do(prev: AppModel): AppModel;
    redo(prev: AppModel): AppModel;
    undo(prev: AppModel): AppModel;
}
export declare abstract class BaseLeafOperation<TContext> implements IOperation<TContext> {
    context: TContext;
    registry: RegistryInterface;
    type: symbol;
    constructor(registry: RegistryInterface, context: TContext);
    abstract do(prev: AppModel): AppModel;
    redo(prev: AppModel): AppModel;
    abstract undo(prev: AppModel): AppModel;
    static isLeafOperation<T>(op: IOperation<T>): op is BaseLeafOperation<T>;
}
export declare abstract class BaseBranchOperation<TContext> implements IOperation<TContext>, IUndoRedoManager {
    operationStack: OperationList;
    context: TContext;
    registry: RegistryInterface;
    type: symbol;
    constructor(registry: RegistryInterface, context: TContext);
    abstract do(prev: AppModel): AppModel;
    redo(prev: AppModel): AppModel;
    undo(prev: AppModel): AppModel;
    static isBranchOperation<T>(op: IOperation<T>): op is BaseBranchOperation<T>;
}
