import { NextResponse } from 'next/server';

const AI_LAWYER_RAG_URL = process.env.AI_LAWYER_RAG_URL || 'http://localhost:5007';
const FLASK_API_KEY = process.env.FLASK_API_KEY || 'eventheodds-flask-api-key-2025';

export async function GET() {
  try {
    const res = await fetch(`${AI_LAWYER_RAG_URL}/enrichment-status`, {
      headers: { 'X-API-Key': FLASK_API_KEY }
    });
    const data = await res.json();
    return NextResponse.json(data);
  } catch (error) {
    return NextResponse.json({ status: 'idle', progress: 0 }, { status: 200 });
  }
}
