const {Router} = require('express')
const router = Router()
/////////////////////////////////////////////////////////// controllers
const sliderController = require('../controllers/sliderController')
const productController = require('../controllers/productController')
const productCategoryController = require('../controllers/productCategoryController')
const blogCategoryController = require('../controllers/blogCategoryController')
const blogPostController = require('../controllers/blogPostController')
const projectController = require('../controllers/projectController')
const contactPageController = require('../controllers/contactPageController')
const contactUsReasonController = require('../controllers/contactUsReasonController')
const mainCatalogController = require('../controllers/mainCatalogController')
const historyController = require('../controllers/historyController')

/////////////////////////////////////////////////////////// routes
//////////////// slider
router.post('/slider', sliderController.create)
router.put('/slider/:id', sliderController.update)
router.delete('/slider/:id', sliderController.delete)

//////////////// blog categories
router.post('/blogCategories', blogCategoryController.create)
router.put('/blogCategories/:id', blogCategoryController.update)
router.delete('/blogCategories/:id', blogCategoryController.delete)

//////////////// blog posts
router.post('/blog', blogPostController.create)
router.put('/blog/:id', blogPostController.update)
router.delete('/blog/:id', blogPostController.delete)

//////////////// product categories
router.post('/productCategories', productCategoryController.create)
router.put('/productCategories/:id', productCategoryController.update)
router.delete('/productCategories/:id', productCategoryController.delete)

//////////////// products
router.post('/products', productController.createProduct)
router.put('/products/:id', productController.updateProduct)
router.delete('/products/:id', productController.deleteProduct)

// product image
router.post('/productImage', productController.createProductImage)
router.delete('/productImage/:imageID', productController.deleteProductImage)

// product PDF
router.post('/productPDF', productController.createPDF)
router.delete('/productPDF/:pdfID', productController.deletePDF)

//////////////// projects
router.post('/projects', projectController.create)
router.put('/projects/:id', projectController.update)
router.delete('/projects/:id', projectController.delete)
// add images
router.post('/projects/images/:id', projectController.addImage)
router.delete('/projects/images/:id', projectController.deleteImage)

//////////////// contact us
router.get('/contact', contactPageController.getAll)
router.get('/contact/:id', contactPageController.getOne)
/// contact us reason
router.post('/contact/reason', contactUsReasonController.create)
router.delete('/contact/reason/:id', contactUsReasonController.delete)

///////////////// main catalog
router.post('/catalog', mainCatalogController.create)

///////////////// history
router.post('/history', historyController.create)
router.put('/history/:id', historyController.update)
router.delete('/history/:id', historyController.delete)

module.exports = router
