import express from 'express';
import authRoutes from './auth';
import projectRoutes from './projects';
import rbacRoutes from './rbac';
import { apiRateLimitMiddleware } from '../middleware/security';

const router = express.Router();

// Health check endpoint
router.get('/health', (req, res) => {
  res.json({
    success: true,
    data: {
      status: 'healthy',
      timestamp: new Date().toISOString(),
      version: '1.0.0'
    }
  });
});

// API version info
router.get('/version', (req, res) => {
  res.json({
    success: true,
    data: {
      version: '1.0.0',
      apiVersion: 'v1',
      environment: process.env.NODE_ENV || 'development'
    }
  });
});

// Apply API rate limiting to all API routes
router.use('/api', apiRateLimitMiddleware);

// Mount route modules
router.use('/api/auth', authRoutes);
router.use('/api/projects', projectRoutes);
router.use('/api/rbac', rbacRoutes);

export default router;