const express = require('express');
const router = express.Router();
const { getAllPages, uploadImage, uploadImages, saveImageDetails, saveImageDetailsBulk, getImages, getImagesByPage, getImageById, getImageByHash, updateImage } = require('../controllers/imageController');
const authMiddleware = require('../middleware/authMiddleware')

router.post('/', authMiddleware, uploadImage, saveImageDetails);
router.post('/bulk', authMiddleware, uploadImages, saveImageDetailsBulk);
router.get('/', authMiddleware, getImages);
router.get('/page/:pageId', getImagesByPage);
router.put('/hash/:id', getImageByHash);
router.get('/pages', getAllPages);
router.get('/:id', getImageById);
router.put('/:id', authMiddleware, updateImage);

module.exports = router;
