import { NextRequest } from "next/server";
import { generateCaptcha } from "../../../../lib/captcha";
import { ok } from "../../../../lib/http";

export async function GET(req: NextRequest) {
  const { id, code } = generateCaptcha(Date.now().toString());
  
  // Log the code to console for dev/demo purposes
  console.log(`CAPTCHA Code: ${code}`);
  
  return ok({ 
    captchaId: id,
    captchaCode: code, // Return the code to display to user
    message: "CAPTCHA code generated. Enter it below to continue.",
  });
}
