import { executeResetCommand } from './reset-command.js';

import type { ICommandModule, ISystemCommand } from '@robota-sdk/agent-framework';
import type { ICommand, ICommandSource } from '@robota-sdk/agent-interface-transport';

const RESET_COMMAND_DESCRIPTION = 'Delete settings';

export function createResetCommandEntry(): ICommand {
  return {
    name: 'reset',
    displayName: 'Reset Settings',
    description: RESET_COMMAND_DESCRIPTION,
    source: 'reset',
    modelInvocable: false,
  };
}

function createResetSystemCommand(): ISystemCommand {
  const entry = createResetCommandEntry();
  return {
    name: entry.name,
    displayName: entry.displayName,
    description: entry.description,
    requiresPermission: true,
    userInvocable: true,
    modelInvocable: false,
    lifecycle: 'inline',
    execute: executeResetCommand,
  };
}

export class ResetCommandSource implements ICommandSource {
  readonly name = 'reset';

  getCommands(): ICommand[] {
    return [createResetCommandEntry()];
  }
}

export function createResetCommandModule(): ICommandModule {
  return {
    name: 'agent-command-reset',
    commandSources: [new ResetCommandSource()],
    systemCommands: [createResetSystemCommand()],
  };
}
