/**
 * Route handlers for `/api/v1/berths/price-reconcile` (CM-2 Part A).
 *
 * In handlers.ts so integration tests can call them directly, bypassing the
 * auth/permission middleware (per CLAUDE.md "Route handler exports").
 */

import { NextResponse } from 'next/server';

import { type RouteHandler } from '@/lib/api/helpers';
import { errorResponse } from '@/lib/errors';
import { listPriceReconciliation } from '@/lib/services/berth-price-reconcile.service';

export const getHandler: RouteHandler = async (_req, ctx) => {
  try {
    const data = await listPriceReconciliation(ctx.portId);
    return NextResponse.json({ data });
  } catch (error) {
    return errorResponse(error);
  }
};
