import { NextResponse } from 'next/server'; import { withAuth, withPermission } from '@/lib/api/helpers'; import { getClientArchiveDossier } from '@/lib/services/client-archive-dossier.service'; import { errorResponse, NotFoundError } from '@/lib/errors'; /** * Read-only preview of "what's at stake" when archiving a client. The UI * fetches this to render the smart-archive modal with the right sections, * decision points, and warnings. */ export const GET = withAuth( withPermission('clients', 'delete', async (_req, ctx, params) => { try { const id = params.id; if (!id) throw new NotFoundError('client'); const dossier = await getClientArchiveDossier(id, ctx.portId); return NextResponse.json({ data: dossier }); } catch (error) { return errorResponse(error); } }), );