const express = require('express');
const router = express.Router();
const LicenseController = require('../controllers/license.controller');
const { authenticateToken } = require('../middleware/auth');
const { canViewAssets, canModifyAssets } = require('../middleware/roleCheck');

router.use(authenticateToken);

router.get('/statistics', canViewAssets, LicenseController.getStatistics);
router.post('/import/entra', canModifyAssets, LicenseController.importFromEntra);
router.get('/', canViewAssets, LicenseController.getAll);
router.get('/:id/users', canViewAssets, LicenseController.getLicenseUsers);
router.get('/:id', canViewAssets, LicenseController.getById);
router.post('/', canModifyAssets, LicenseController.create);
router.put('/:id', canModifyAssets, LicenseController.update);
router.delete('/:id', canModifyAssets, LicenseController.delete);

module.exports = router;
