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

// Scanner push endpoints — no JWT, uses X-Scanner-Key header
router.post('/assets', ctrl.reportAssets);
router.post('/alert', ctrl.reportAlert);

// Read endpoints — require JWT
router.use(authenticateToken);
router.get('/sites', ctrl.getSites);
router.get('/assets', ctrl.getAssets);
router.get('/alerts', ctrl.getAlerts);
router.get('/stats', ctrl.getStats);

module.exports = router;
