import express from 'express';
import { register, login } from '../controllers/authController.js';
import requireRole from '../middleware/requireRole.js';

const router = express.Router();

// Public routes
router.post('/register', register);
router.post('/login', login);

// Protected routes - only users with 'user' role or higher
router.get('/profile', requireRole(['user', 'moderator', 'admin']), (req, res) => {
  res.json({ message: 'Profile data', user: req.user });
});

export default router;