import { NextResponse } from 'next/server';

import { withAuth, withPermission } from '@/lib/api/helpers';
import { listManualReconcileBerths } from '@/lib/services/berths.service';
import { errorResponse } from '@/lib/errors';

export const GET = withAuth(
  withPermission('berths', 'edit', async (_req, ctx) => {
    try {
      const result = await listManualReconcileBerths(ctx.portId);
      return NextResponse.json(result);
    } catch (error) {
      return errorResponse(error);
    }
  }),
);
