const express = require('express');
const router = express.Router();
const { authenticateToken } = require('../middleware/auth');
const { requireAdmin } = require('../middleware/roleCheck');
const ctrl = require('../controllers/unifi.controller');

router.get('/config',   authenticateToken, requireAdmin, ctrl.getConfig);
router.post('/config',  authenticateToken, requireAdmin, ctrl.saveConfig);
router.get('/devices',  authenticateToken, requireAdmin, ctrl.getDevices);
router.post('/sync',    authenticateToken, requireAdmin, ctrl.sync);

module.exports = router;
