const express = require("express");
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.json({ limit: '100mb' }));
app.use(bodyParser.urlencoded({ limit: '500mb', extended: true, parameterLimit: 100000 }));
const { catchErrors, checkToken } = require("../handlers/errorHandlers");  
const authenticateUserByToken = require("../apps/middlewares/authenticateUserByToken");
const router = express.Router();
const SolrController = require("../controllers/ShopperrB2B/SolrController");
const ProductController = require("../controllers/ShopperrB2B/ProductController");

//_______________________________ Start Amz SP-API List Orders management_______________________________
router.route("/solr/toprated").post(catchErrors(SolrController.topratedProducts));
router.route("/solr/searchproducts").post(catchErrors(SolrController.searchProducts));
router.route("/solr/allproducts").post(checkToken,catchErrors(SolrController.allProduct));
router.route("/solr/categorybyproduct").post(checkToken,catchErrors(SolrController.categoryByProduct));
router.route("/solr/getproduct").post(SolrController.getSingleProductByHandle);
router.route("/getproductinfoByPId").post(ProductController.getProductInfobyProductId);
router.route("/addtocart").post(checkToken,catchErrors(ProductController.addToCart));
router.route("/get-categories").post(ProductController.getCategories);
router.route("/solr/updatecategorybytitle").get(SolrController.updateCategoryByTitle);
router.route("/solr/searchbysku").get(SolrController.searchBySku);
router.route("/solr/commonsearch").post(checkToken,catchErrors(SolrController.commonSearch));
//router.route("/updatecustomer").post(SolrController.updateCustomer);

module.exports = router;
