value}] is not currently available for booking."); } public static function duplicateOption(VehicleOption $vehicleOption): self { return new self("Vehicle option [{$vehicleOption->value}] was selected more than once — combine it into a single selection."); } public static function wholeVehicleCannotBeCombined(): self { return new self('Whole Vehicle cannot be combined with other vehicle options in the same booking.'); } /** * A rejected vehicle selection is a client input problem, not a server * error — surface it as 422 rather than the default 500. A broader JSON * error envelope for all of api/* is Phase 6 (T6.3); this keeps the * mapping local until that lands. */ public function render(Request $request): ?JsonResponse { if ($request->expectsJson()) { return response()->json(['message' => $this->getMessage()], 422); } return null; } }