const express = require('express');
const router = express.Router();
const shiftsController = require('../controllers/shiftsController');
const { requireAuth, requireAdmin } = require('../middleware/auth');

// Public routes (authenticated users)
router.get('/', requireAuth, shiftsController.getAll);
router.get('/my-signups', requireAuth, shiftsController.getUserSignups);
router.post('/:shiftId/signup', requireAuth, shiftsController.signup);
router.post('/:shiftId/cancel', requireAuth, shiftsController.cancelSignup);

// Admin routes
router.get('/admin', requireAdmin, shiftsController.getAllAdmin);
router.post('/admin', requireAdmin, shiftsController.create);
router.put('/admin/:id', requireAdmin, shiftsController.update);
router.delete('/admin/:id', requireAdmin, shiftsController.delete);

module.exports = router;