const express = require('express');
const router = express.Router();
const authRoutes = require('./authRoutes');
const dashboardRoutes = require('./dashboardRoutes');
const companyRoutes = require('./companyRoutes');
const masterRoutes = require('./masterRoutes');
const purchaseRoutes = require('./purchaseRoutes');
const inventoryRoutes = require('./inventoryRoutes');
const productionRoutes = require('./productionRoutes');
const storesRoutes = require('./storesRoutes');
const salesRoutes = require('./salesRoutes');
const customerRoutes = require('./customerRoutes');
const financeRoutes = require('./financeRoutes');
const hrRoutes = require('./hrRoutes');
const reportRoutes = require('./reportRoutes');
const publicRoutes = require('./publicRoutes');
const approvalRoutes = require('./approvalRoutes');
const notificationRoutes = require('./notificationRoutes');
const qaRoutes = require('./qaRoutes');

// Health check endpoint (also available at root /health)
router.get('/health', (req, res) => {
  res.json({
    success: true,
    message: 'Server is running',
    timestamp: new Date().toISOString(),
    apiVersion: 'v1'
  });
});

router.use('/public', publicRoutes);
router.use('/auth', authRoutes);
router.use('/dashboard', dashboardRoutes);
router.use('/company', companyRoutes);
router.use('/master', masterRoutes);
router.use('/purchase', purchaseRoutes);
router.use('/approval', approvalRoutes);
router.use('/notification', notificationRoutes);
router.use('/inventory', inventoryRoutes);
router.use('/production', productionRoutes);
router.use('/stores', storesRoutes);
router.use('/sales', salesRoutes);
router.use('/customer', customerRoutes);
router.use('/finance', financeRoutes);
router.use('/hr', hrRoutes);
router.use('/report', reportRoutes);
router.use('/qa', qaRoutes);

module.exports = router;

