text: import express from 'express';
  import multer from 'multer';
  import spaceHandler from '../Controllers/spaces';
  import messageHandler from '../Controllers/messages';
  import rentalHandler from '../Controllers/rental';
  import reviewHandler from '../Controllers/reviews';
  import spaceController from '../Controllers/userControlers/SpaceController';
  // // auth middlewares for admin
  // import isAdminMiddleware from '../Middlewares/isManager';
  // auth middleware for user
  import isLoggedInUser from '../Middlewares/loggedIn';
  // validations
  import spaceValidator from '../validations/space';
  
  const storage = multer.memoryStorage();
  const upload = multer({
      storage,
  });
  
  const spaceRouter = express.Router();
  
  
  spaceRouter.get('/', isLoggedInUser.isLoggedIn, spaceHandler.getSpaces);
  spaceRouter.get('/by-limit', isLoggedInUser.isLoggedIn, spaceHandler.getSpacesByLimit);
  spaceRouter.get('/message', isLoggedInUser.isLoggedIn, messageHandler.getMessagesByOwner);
  spaceRouter.get('/:id', spaceHandler.getSpaceById);
  spaceRouter.get('/rentals', isLoggedInUser.isLoggedIn, rentalHandler.getUserAllRentals);
  spaceRouter.get('/rentals/availability/:id', isLoggedInUser.isLoggedIn, rentalHandler.getSpaceAllRentals);
  spaceRouter.get('/user/all', isLoggedInUser.isLoggedIn, spaceHandler.getUserSpaces);
  spaceRouter.get('/distric/count', spaceHandler.getCountOfSpacesInEachDistric);
  spaceRouter.get('/category/:category', isLoggedInUser.isLoggedIn, spaceHandler.getSpacesByCategory);
  spaceRouter.get('/:distric/:distric', spaceController.getSpacesByTypeAndValue);
  spaceRouter.post('/', upload.array('images'), isLoggedInUser.isLoggedIn, spaceHandler.addSpace);
  spaceRouter.post('/review/:spaceId', isLoggedInUser.isLoggedIn, reviewHandler.addReview);
  spaceRouter.post('/search', isLoggedInUser.isLoggedIn, spaceHandler.searchSpaces);
  spaceRouter.post('/message', isLoggedInUser.isLoggedIn, messageHandler.sendMessageToListingOwner);
  spaceRouter.post('/search/filter', isLoggedInUser.isLoggedIn, spaceHandler.searchSpacesByFilter);
  spaceRouter.post('/rental/:spaceId', isLoggedInUser.isLoggedIn, rentalHandler.allotRentalSpaceToClient);
  spaceRouter.post('/rental/check/validity/:id', rentalHandler.checkingValidityOfSelectedDates);
  spaceRouter.patch('/:id', upload.single('imageUrl'), isLoggedInUser.isLoggedIn, spaceHandler.updateSpace);
  spaceRouter.patch('/image/update/:id', upload.single('imageUrl'), isLoggedInUser.isLoggedIn, spaceHandler.updateSpaceImage);
  spaceRouter.patch('/image/remove/:id', isLoggedInUser.isLoggedIn, spaceHandler.removeSpaceImage);
  spaceRouter.patch('/activation/:id', isLoggedInUser.isLoggedIn, spaceHandler.spaceActivation);
  spaceRouter.delete('/:id', isLoggedInUser.isLoggedIn, spaceHandler.deleteSpace);
  
  export default spaceRouter;
  