import { NextResponse } from 'next/server';

import { withPortalAuth } from '@/lib/portal/helpers';
import { getClientInterests } from '@/lib/services/portal.service';
import { logger } from '@/lib/logger';

export const GET = withPortalAuth(async (_req, session) => {
  try {
    const data = await getClientInterests(session.clientId, session.portId);
    return NextResponse.json({ data });
  } catch (error) {
    logger.error({ error }, 'Portal interests fetch failed');
    return NextResponse.json({ error: 'Failed to load interests' }, { status: 500 });
  }
});
