import { FastifyReply, FastifyRequest } from 'fastify';

import { getCatalogResponse } from '../checkout/catalog';

export async function handleCheckoutCatalog(
  request: FastifyRequest<{ Querystring: { cartTotal?: string } }>,
  reply: FastifyReply,
): Promise<void> {
  const cartTotal = parseFloat(request.query.cartTotal ?? '0') || 0;
  reply.send(getCatalogResponse(cartTotal));
}
