import a from './index5.mjs';
import { a as restoreConfigSnapshot } from '../shared/ccjk.BzPbSEP2.mjs';
import '../shared/ccjk.BAGoDD49.mjs';
import 'node:fs';
import './constants.mjs';
import 'node:os';
import './index2.mjs';
import 'node:process';
import 'node:url';
import '../shared/ccjk.bQ7Dh1g4.mjs';
import './fs-operations.mjs';
import 'node:crypto';
import 'node:fs/promises';

async function rollbackCommand(id, options = {}) {
  if (!id) {
    console.error(a.red("Snapshot id is required."));
    console.log(a.gray("Run: npx ccjk snapshot"));
    return;
  }
  try {
    const result = restoreConfigSnapshot(id);
    if (options.json) {
      console.log(JSON.stringify(result, null, 2));
      return;
    }
    console.log(a.green(`Rollback complete: ${id}`));
    console.log(a.gray(`Restored files: ${result.restored.length}`));
    if (result.skipped.length > 0) {
      console.log(a.yellow(`Skipped files: ${result.skipped.length}`));
    }
  } catch (error) {
    const message = error instanceof Error ? error.message : String(error);
    console.error(a.red(message));
  }
}

export { rollbackCommand };
