// app/api/debug-documents/route.ts
export const dynamic = "force-dynamic";
import { NextResponse } from "next/server";
import { cookies } from "next/headers";

export async function GET(req: Request) {
  const c = cookies();
  const { searchParams } = new URL(req.url);
  
  const cookieInfo = {
    active_org_key: c.get("active_org_key")?.value || null,
    active_org_name: c.get("active_org_name")?.value || null,
    active_org_id: c.get("active_org_id")?.value || null,
  };

  const params = {
    category: searchParams.get('category'),
    all_params: Object.fromEntries(searchParams.entries())
  };

  const apiBase = process.env.NEXT_PUBLIC_API_BASE || process.env.LAMBDA_API_BASE;

  return NextResponse.json({
    message: "Debug Documents API",
    cookies: cookieInfo,
    params,
    env: {
      apiBase,
      hasApiBase: !!apiBase
    }
  });
}
