import { Router } from 'express';
import auth from '../middleware/auth.js';
import upload from '../middleware/upload.js';
import { getAll, getOne, create, update, remove } from '../controllers/showroomController.js';

const router = Router();

// Configure multer for multiple image uploads
const uploadImages = upload.fields([
  { name: 'image1', maxCount: 1 },
  { name: 'image2', maxCount: 1 }
]);

router.get('/', getAll);
router.get('/:id', getOne);
router.post('/', auth, uploadImages, create);
router.put('/:id', auth, uploadImages, update);
router.delete('/:id', auth, remove);

export default router;