const express = require('express');
const productController = require('../controllers/product');
// console.log(userController);
// Routing Component
const router = express.Router();
// Auth import
const auth = require('../auth')
// Auth
const {verify,verifyAdmin} = auth;
// verifyng 




// Route for user authenctication for log in

router.post("/product", verify,verifyAdmin,productController.createProduct);

router.get('/allproduct',productController.getAllProducts);

router.get('/activeproduct',productController.getactiveproduct);


router.get('/:productId',productController.getProduct);

router.put("/:productId", verify,verifyAdmin,productController.updateProduct);

router.put('/:productId/archive', productController.archiveProduct);

router.put('/:productId/activate', productController.activateProduct);

router.post('/search', productController.searchProductsByName);

// Route to search for courses by course price
router.post('/searchByPrice', productController.searchProductsByPriceRange);

// router.put('/products/:id',verify,verifyAdmin,productController.updateProduct);

// router.delete('/products/:id',verify,verifyAdmin,productController.deleteProduct);


module.exports = router;