import type { IEventEmitter } from '../../types'; import type { IStateManager } from './state'; export interface ICommandManager { init(options: CommandManagerInitOptions): void; execute(command: ICommand): Promise; executeBatch(commands: ICommand[]): Promise; undo(): Promise; redo(): Promise; serialize(): any[]; clear(): void; canUndo(): boolean; canRedo(): boolean; getHistorySize(): number; destroy(): void; } export interface ICommand { apply(state: IStateManager): Promise; undo(state: IStateManager): Promise; serialize(): any; } export interface CommandManagerInitOptions { emitter: IEventEmitter; state: IStateManager; } export type HistoryChangePayload = { type: 'history:change'; action: 'execute' | 'undo' | 'redo'; };