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

// All user routes require admin access
router.use(requireAdmin);

// Get all users
router.get('/', usersController.getAll);

// Create new user
router.post('/', usersController.create);

// Send login details to user
router.post('/:id/send-login-details', usersController.sendLoginDetails);

// Email all users
router.post('/email-all', usersController.emailAllUsers);

// Delete user
router.delete('/:id', usersController.delete);

module.exports = router;