var express = require('express');
const userController = require('../controller/userController');
var router = express.Router();

// home page
router.get('/', userController.home);
// about us
router.get('/about-us', userController.about);
// products
router.get('/products/:category', userController.products);
// contact us
router.get('/contact-us', userController.contactus);
// login
router.get('/auth', userController.login);
// logout
router.get('/logout', userController.logout);
// profile
router.get('/profile', userController.profile);
// change password
router.get('/changepassword', userController.changePassword);
// address
router.get('/address', userController.address);
// orders
router.get('/orders', userController.orders);
// forgot password
router.get('/forgotpassword', userController.forgotpassword);
// forgot password
router.get('/cart', userController.cart);
// product details
router.get('/details/:p_code', userController.details);
// checkout
router.get('/checkout', userController.checkout);
// success
router.get('/success/:order_id', userController.success);
// error
router.get('/error/', userController.error);
// Invoice
router.get('/invoice/:order_id', userController.invoice);
// Download Pdf
router.get('/invoiceDownload/:order_id', userController.invoiceDownload);

// functionality

// login
router.post('/login', userController.validateInput('login'), userController.validateLogin);
// register
router.post('/register', userController.validateInput('register'), userController.registerFunctionality);
// contact us
router.post('/contact', userController.validateInput('contact'), userController.contact);
// profile
router.post('/updateProfile', userController.validateInput('profile'), userController.updateProfile);
// change password
router.post('/changePassword', userController.validateInput('changepassword'), userController.changeExistingPassword);
// add address
router.post('/addAddress', userController.validateInput('address'), userController.addAddress);
// update address
router.post('/updateAddress', userController.validateInput('address'), userController.updateAddress);
// delete address
router.post('/deleteAddress', userController.deleteAddress);
// Forgot Password 
router.post('/forgotPassword', userController.validateInput('forgotpassword'), userController.forgotPasswordSendMail);
// Forgot Password Verification 
router.post('/forgotPasswordVerification', userController.validateInput('forgotPasswordVerification'), userController.forgotPasswordVerification);
// Forgot Password Upadte Password 
router.post('/updatePassword', userController.validateInput('updatePasswordVerification'), userController.updatePasswordVerification);
// Add To Cart
router.post('/addToCart', userController.validateInput('addtocart'), userController.addToCart);
// Remove from Cart
router.post('/removeFromCart', userController.validateInput('addtocart'), userController.removeFromCart);
// Remove CartQuantity
router.post('/removeCartQuantity', userController.validateInput('addtocart'), userController.removeCartQuantity);
// Clear Cart
router.get('/clearCart', userController.clearCart);
// Verify Payment
router.post('/validateOrder', userController.validateOrder);
// Place Order
router.post('/placeOrder', userController.placeOrder);
// Get Total
router.get('/getCartTotal', userController.getCartTotal);
// Get Tracking
router.post('/trackOrder/', userController.trackOrder);


module.exports = router;