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 {checkToken} = require("../handlers/tokenCheck");
const router = express.Router();
const AuthController = require("../controllers/AuthController");
   
//_______________________________ Start Auth_______________________________

// router.route("/login").post(catchErrors(AuthController.Login));
router.route("/login").post(checkToken, catchErrors(AuthController.Login));
router.route("/adminLogin").post(checkToken, catchErrors(AuthController.AdminLogin));
router.route("/merchant-login").post(checkToken, catchErrors(AuthController.merchantLogin));
router.route("/customerlogin").post(checkToken, catchErrors(AuthController.CustomerLogin));
router.route("/forgotpassword").post(checkToken, catchErrors(AuthController.CustomerForgotPassword));
router.route("/wholesalesignup").post(checkToken, catchErrors(AuthController.wholesaleSignup));
router.route("/customersignup").post(checkToken, catchErrors(AuthController.CustomerSignup));
router.route("/suppliersignUp").post(checkToken, catchErrors(AuthController.SupplierSignUp ));
// router.route("/merchantsignUp").post(catchErrors(AuthController.merchantSignUp));
router.route("/subadminsignup").post(checkToken, catchErrors(AuthController.subAdminSignup));   
// router.route("/subadminuser/:id").get(catchErrors(AuthController.subAdminUser));
// router.route("/subadminuser").post(catchErrors(AuthController.subAdminUser));
router.route("/subadminaccount").patch(checkToken, catchErrors(AuthController.subAdminAccount));
// router.route("/transactiondetail").post(catchErrors(AuthController.transactionDetail));
// router.route("/gettransaction").get(catchErrors(AuthController.getTransaction));
// router.route("/leftordermerchantshopify/:store").get(catchErrors(AuthController.leftOrdermerchantShopify));
// router.route("/merchantshopifyordersunfulfilled/:store").get(catchErrors(AuthController.merchantShopifyOrdersUnfulfilled));
// router.route("/supplierordermerchant").get(catchErrors(AuthController.supplierOrderMerchant));
// router.route("/supplierOrderfrommerchant/:orderId").patch(catchErrors(AuthController.supplierOrderFromMerchant));
router.route("/signupotp").post(catchErrors(AuthController.signUpOtp));
router.route("/signUpMerchant").post(catchErrors(AuthController.signUpMerchant));
router.route("/reset-password").post(catchErrors(AuthController.resetPassword));
router.route("/update-password").post(catchErrors(AuthController.updatePassword));
//_______________________________ End Auth_______________________________
module.exports = router;
