/**
 * Built-in History Commands
 *
 * Commands for history manipulation:
 * - undo: Undo last action
 * - redo: Redo last undone action
 */

import type { CommandDefinition } from '../types';
import { registerCommand } from '../registry';

/**
 * Undo last action
 */
export const undoCommand: CommandDefinition = {
	name: 'undo',
	description: 'Undo the last action',
	aliases: ['z'],
	category: 'history',
	inputs: [],
	execute: async (_inputs, ctx) => {
		ctx.history.undo();
	},
};

/**
 * Redo last undone action
 */
export const redoCommand: CommandDefinition = {
	name: 'redo',
	description: 'Redo the last undone action',
	aliases: ['y'],
	category: 'history',
	inputs: [],
	execute: async (_inputs, ctx) => {
		ctx.history.redo();
	},
};

/**
 * Register all history commands
 */
export function registerHistoryCommands(): void {
	registerCommand(undoCommand);
	registerCommand(redoCommand);
}
