import { Router, type IRouter } from 'express';
import { authenticate, authorize } from '../middlewares/auth.middleware.js';
import * as platformStaffController from '../controllers/platform-staff.controller.js';

const router: IRouter = Router();

router.use(authenticate);
router.use(authorize('owner', 'cfo'));

// Solo platform_admin (verificado dentro del controller)
router.get('/', platformStaffController.listStaff);
router.get('/search', platformStaffController.searchUsers);
router.post('/grant', platformStaffController.grantRole);
router.post('/revoke', platformStaffController.revokeRole);

export { router as platformStaffRoutes };
