/**
 * GET /api/analyzer/itglue/configurations/:id/xrefs
 */

import { NextRequest, NextResponse } from 'next/server';
import { requireAuth } from '@/lib/auth-utils';
import { listXrefsForAsset } from '@/lib/services/analyzer/asset-audit/xrefs';

export async function GET(
  _request: NextRequest,
  { params }: { params: Promise<{ id: string }> }
) {
  const { error } = await requireAuth();
  if (error) return error;
  const { id } = await params;
  const xrefs = await listXrefsForAsset('configuration', id, 100);
  return NextResponse.json({ xrefs });
}
