/**
 * RAG Ingest API
 * 
 * Triggers re-ingestion of all business documents.
 * Use when documents have been updated.
 * 
 * POST /api/gfs/rag/ingest
 */

import { NextResponse } from 'next/server';
import { reingestDocuments } from '@/lib/gfs/rag';

export const dynamic = 'force-dynamic';

export async function POST() {
  try {
    const result = reingestDocuments();

    return NextResponse.json({
      success: result.success,
      ingestion: result,
    });
  } catch (error) {
    return NextResponse.json(
      { error: 'Re-ingestion failed' },
      { status: 500 }
    );
  }
}
