import { NextResponse } from "next/server";
import { startDailyReportCron } from "@/lib/daily-report-cron";

export const runtime = "nodejs";

// Guard: only start cron once per server instance
let started = false;

export async function GET() {
  if (started) {
    return NextResponse.json({ status: "already_started" });
  }
  started = true;

  startDailyReportCron();
  return NextResponse.json({ status: "started" });
}
