// apps/api/src/middleware/admin.middleware.js

const { ROLES } = require('../../../../packages/shared/roles');

function adminMiddleware(req, res, next) {
    if (!req.user) {
        return res.status(401).json({ error: 'Not authenticated' });
    }
    
    if (req.user.role !== ROLES.ADMIN && req.user.role !== ROLES.SUPER_ADMIN) {
        return res.status(403).json({ error: 'Admin access required' });
    }
    
    next();
}

module.exports = adminMiddleware;