import { NextResponse } from 'next/server';

const REMINDER_SVC = process.env.REMINDER_SERVICE_URL ||
  'http://reminder-service.ai-agents.svc.cluster.local:6001';

export async function POST(request) {
  try {
    const body = await request.json();
    const res  = await fetch(`${REMINDER_SVC}/reminders`, {
      method:  'POST',
      headers: { 'Content-Type': 'application/json' },
      body:    JSON.stringify(body),
    });
    const data = await res.json();
    return NextResponse.json(data, { status: res.ok ? 200 : res.status });
  } catch (err) {
    return NextResponse.json({ error: err.message }, { status: 500 });
  }
}
