import { Command, Flags } from "@oclif/core";
import { sharedFlags } from "../../../command-helpers.mjs";
import { runDatabaseSnapshotCaptureCommand } from "../../../db.mjs";

export default class DbSnapshotCaptureCommand extends Command {
  static summary = "Capture a database schema snapshot";

  static enableJsonFlag = true;

  static flags = {
    ...sharedFlags,
    output: Flags.string({
      description: "Output path for the snapshot",
    }),
  };

  async run() {
    const { flags } = await this.parse(DbSnapshotCaptureCommand);
    await runDatabaseSnapshotCaptureCommand(flags);
    return { ok: true };
  }
}
