import { Command } from "commander";
import { computeActionTime } from "../controllers/metric";

export const metricCommand = new Command("metric");

metricCommand
  .command("action-time")
  .option("-f, --file <file>", "Export file path")
  .option(
    "--start <string>",
    "Only check action time for reports starting from a specific timestamp",
    (value) => new Date(value).toISOString()
  )
  .option(
    "--end <string>",
    "Only check action time for reports before a specific timestamp",
    (value) => new Date(value).toISOString()
  )
  .description("Compute average action time for reports")
  .action(async (options: { start?: string; end?: string; file?: string }) => {
    await computeActionTime(options);
  });
