import { invalidV3Input, unavailableV3Read, V3_UINT } from '../../_lib/http';
import { requireV3X402Release } from '../../x402/_lib/release';

export async function GET(
  _request: Request,
  context: { params: Promise<{ disputeId: string }> | { disputeId: string } },
): Promise<Response> {
  const closed = requireV3X402Release();
  if (closed) return closed;
  const { disputeId } = await context.params;
  if (!V3_UINT.test(disputeId)) return invalidV3Input('invalid_dispute_id', 'Dispute ID must be an unsigned decimal integer');
  return unavailableV3Read({
    route: '/api/v3/disputes/:disputeId',
    resource: `/api/v3/disputes/${disputeId}`,
    code: 'v3_dispute_reader_unconfigured',
    message: 'The V3 dispute registry address and read adapter are not configured',
  });
}
