const express = require('express')
const router = express.Router()
const hospitalController = require('../../controllers/admin/HospitalController.js')
const vendorHistoryController = require('../../controllers/admin/VendorHistoryController.js')
const executivesHistoryController = require('../../controllers/admin/ExecutivesHistoryController.js')
const verifyJWT = require('../../middleware/VerifyJWT.js');
const checkRole = require('../../middleware/CheckRole.js');
const upload = require('../../middleware/UploadImage.js');

router.get('/', verifyJWT, checkRole(['admin']), hospitalController.getAllHospital);
router.post('/', verifyJWT, upload.single('image'), checkRole(['admin']), hospitalController.storeHospital);
router.get('/:id', verifyJWT, checkRole(['admin']), hospitalController.showHospital);
router.patch('/:id', verifyJWT, upload.single('image'), checkRole(['admin']), hospitalController.updateHospital);
router.delete('/:id', verifyJWT, checkRole(['admin']), hospitalController.deleteHospital);

// Vendor History
router.get('/:id/vendor-history', verifyJWT, checkRole(['admin']), vendorHistoryController.getAllVendorHistory);
router.post('/:id/vendor-history', verifyJWT, checkRole(['admin']), vendorHistoryController.storeVendorHistory);
router.get('/:id/vendor-history/:id_vendor_history', verifyJWT, checkRole(['admin']), vendorHistoryController.showVendorHistory);
router.patch('/:id/vendor-history/:id_vendor_history', verifyJWT, checkRole(['admin']), vendorHistoryController.updateVendorHistory);
router.delete('/:id/vendor-history/:id_vendor_history', verifyJWT, checkRole(['admin']), vendorHistoryController.deleteVendorHistory);

// Executives History
router.get('/:id/executives-history', verifyJWT, checkRole(['admin']), executivesHistoryController.getAllExecutivesHistory);
router.post('/:id/executives-history', verifyJWT, checkRole(['admin']), executivesHistoryController.storeExecutivesHistory);
router.get('/:id/executives-history/:id_executives_history', verifyJWT, checkRole(['admin']), executivesHistoryController.showExecutivesHistory);
router.patch('/:id/executives-history/:id_executives_history', verifyJWT, checkRole(['admin']), executivesHistoryController.updateExecutivesHistory);
router.delete('/:id/executives-history/:id_executives_history', verifyJWT, checkRole(['admin']), executivesHistoryController.deleteExecutivesHistory);

module.exports = router;