class RentVehicleUseCase implements RentVehicleInputPort {

    @Override
    public void rentVehicle(final RentVehicleInputData inputData,
        final RentVehicleOutputPort outputPort) {
        boolean rented = false;
        final Optional<Renter> renterOptional = findRenter(inputData.getRenterEmail());
        final Optional<Vehicle> vehicleOptional = findVehicle(inputData.getVehicleType(),
            inputData.getVehicleBrand(), inputData.getVehicleModel(), inputData.getPickupDate(),
            inputData.getReturnDate());
        final Optional<Location> pickupLocationOptional = findLocation(
            inputData.getPickupLocationName());
        final Optional<Location> returnLocationOptional = findLocation(
            inputData.getReturnLocationName());
        String rentId = null;
        if (renterOptional.isPresent() && vehicleOptional.isPresent() && pickupLocationOptional
            .isPresent() && returnLocationOptional.isPresent()) {
            Reservation reservation = new Reservation();
            reservation.setRenter(renterOptional.get());
            reservation.setPickupDate(inputData.getPickupDate());
            reservation.setReturnDate(inputData.getReturnDate());
            reservation.setVehicle(vehicleOptional.get());
            reservation.setPickupLocation(pickupLocationOptional.get());
            reservation.setReturnLocation(returnLocationOptional.get());
            gatewaysAccessor.getReservationGateway().save(reservation);
            rentId = reservation.getId();
            rented = true;
        }

        final RentVehicleOutputData outputData = new RentVehicleOutputData(rented, rentId);
        outputPort.present(outputData);
    }

    public  RentVehicleUseCase(final GatewaysAccessor gatewaysAccessor);

}