import { Args, Command } from "@oclif/core";
import { executeRunCommand, runFlags } from "../command-helpers.mjs";

export default class RunCommand extends Command {
  static summary = "Run test suites";

  static enableJsonFlag = true;

  static args = {
    type: Args.string({
      description: "Optional suite type shortcut: int, e2e, dal, load, pw, all",
      required: false,
      options: ["int", "e2e", "dal", "load", "pw", "all"],
    }),
  };

  static flags = runFlags;

  async run() {
    const { args, flags } = await this.parse(RunCommand);
    return executeRunCommand(this, flags, args.type || null);
  }
}
