import type { VercelRequest, VercelResponse } from '@vercel/node';

/**
 * POST /api/roast
 * Request: { content: string }
 * Response: { text: string }
 *
 * IMPORTANT: keep provider API keys server-side only.
 */
export default async function handler(req: VercelRequest, res: VercelResponse) {
  if (req.method !== 'POST') {
    res.status(405).json({ text: 'Method Not Allowed' });
    return;
  }

  const content = (req.body?.content ?? '').toString();
  if (!content.trim()) {
    res.status(400).json({ text: 'Missing content' });
    return;
  }

  // TODO (Codex): Call provider here (Gemini/OpenAI/etc.) using server env vars.
  // Example:
  // const text = await generateRoastWithGemini(content);

  res.status(501).json({ text: 'Not implemented: wire server-side LLM provider here.' });
}
