const express = require('express');
const router = express.Router();
const { authMiddleware } = require('../middleware/authMiddleware');

// Import controllers - make sure these functions exist
const reportController = require('../controllers/reportController');

// Check if functions exist before using them
console.log('Available report functions:', Object.keys(reportController));

// Apply auth middleware to all routes
router.use(authMiddleware);

// Report routes - make sure each function exists
router.get('/monthly-payroll', reportController.getMonthlyPayroll);
router.get('/available-months', reportController.getAvailableMonths);

// Simple test route
router.get('/test', (req, res) => {
    res.json({ message: 'Report routes are working' });
});

module.exports = router;