import { NextResponse } from 'next/server';

const EXTRACTION_URL = process.env.EXTRACTION_SERVICE_URL || 'http://localhost:4005';

export async function GET() {
  try {
    const res = await fetch(`${EXTRACTION_URL}/health`, {
      signal: AbortSignal.timeout(2000),
    });
    if (res.ok) {
      const data = await res.json();
      return NextResponse.json(data);
    }
    return NextResponse.json({ status: 'error' });
  } catch {
    return NextResponse.json({ status: 'offline' });
  }
}
