const express = require('express');
const { isAuth, validation } = require('../../../middlewares');
const { body } = require('express-validator');
const {
  getRecentBookingsByCustomerId,
  getAllBookings,
  getBookingsByReferenceNo,
  deleteCancelledBooking,
  acceptBooking,
} = require('../../../controllers/host/bookings');

const router = express.Router();

router.get('/:customerId', isAuth, getRecentBookingsByCustomerId);
router.get('/search/:bookingNo', isAuth, getBookingsByReferenceNo);
router.get('/', isAuth, getAllBookings);
router.delete('/:bookingId', isAuth, deleteCancelledBooking);
router.patch('/:referenceNo', isAuth, [body('status').notEmpty()], validation, acceptBooking);

module.exports = router;
