// // routes/reportRoutes.js
// const express = require('express');
// const router = express.Router();
// const reportController = require('../controllers/reportController');
// const { authenticate, authorize } = require('../middleware/auth');

// router.use(authenticate);
// router.use(authorize(['admin', 'manager']));

// router.get('/sales', reportController.getSalesReport);
// // router.get('/sales/daily', reportController.getDailySalesReport);
// // router.get('/sales/by-category', reportController.getSalesByCategory);
// // router.get('/sales/by-product', reportController.getSalesByProduct);
// router.get('/top-selling-products', reportController.getTopSellingProducts);
// router.get('/payment-methods', reportController.getPaymentMethodReport);
// // router.get('/inventory', reportController.getInventoryReport);
// // router.get('/customer-analytics', reportController.getCustomerAnalytics);
// // router.get('/employee-performance', reportController.getEmployeePerformance);
// // router.get('/profit-margin', reportController.getProfitMarginReport);

// module.exports = router;


// routes/reportRoutes.js
const express = require('express');
const router = express.Router();
const reportController = require('../controllers/reportController');
const { authenticate, authorize } = require('../middleware/auth');

// Apply authentication to all routes
router.use(authenticate);

// ==================== CORE REPORTS ====================
// Sales Report - Daily/Weekly/Monthly breakdown
router.get('/getSalesReport', 
  authorize('admin', 'manager'), 
  reportController.getSalesReport
);

// Top Selling Products
router.get('/getTopSellingProducts', 
  authorize('admin', 'manager'), 
  reportController.getTopSellingProducts
);

// Payment Method Distribution
router.get('/getPaymentMethodReport', 
  authorize('admin', 'manager'), 
  reportController.getPaymentMethodReport
);

// ==================== DETAILED REPORTS ====================
// Cash vs Mobile Money Analysis
router.get('/cash-vs-mobile-money', 
  authorize('admin', 'manager'), 
  reportController.getCashVsMobileMoneyReport
);

// Cashier Performance Metrics
router.get('/cashier-performance', 
  authorize('admin', 'manager'), 
  reportController.getCashierPerformanceReport
);

// Store Comparison (Multi-store)
router.get('/store-comparison', 
  authorize('admin'), 
  reportController.getStoreComparisonReport
);

// ==================== PATTERN ANALYSIS ====================
// Hourly Sales Pattern (Peak hours analysis)
router.get('/hourly-pattern', 
  authorize(['admin', 'manager']), 
  reportController.getHourlySalesPattern
);

// Product Category Performance
router.get('/category-analysis', 
  authorize(['admin', 'manager']), 
  reportController.getProductCategoryReport
);

// ==================== DASHBOARD SUMMARY ====================
// Comprehensive dashboard summary (combines multiple metrics)
router.get('/dashboard-summary', 
  authorize(['admin', 'manager']), 
  reportController.getDashboardSummary
);

module.exports = router;