import { Router } from 'express';
import { featureFlagsController } from './feature-flags.controller.js';
import { authenticate } from '../../shared/middleware/auth.middleware.js';

const router = Router();

router.use(authenticate);

// Public evaluation (for current tenant)
router.post('/evaluate', (req, res, next) => featureFlagsController.evaluateFlags(req, res, next));

// Admin routes (should add isSuperuser or permission check)
router.get('/', (req, res, next) => featureFlagsController.getAllFlags(req, res, next));
router.post('/overrides', (req, res, next) => featureFlagsController.upsertOverride(req, res, next));

export default router;
