/**
 * User Routes
 *
 * Express routes for user profile management
 */

import { Router } from 'express';
import { userController } from './user.controller';
import { authenticate, requireAdmin } from '../../shared/middleware/auth.middleware';

const router = Router();

// ============================================
// PROFILE ROUTES (authenticated user)
// ============================================

router.get('/me', authenticate, userController.getProfile);
router.put('/me', authenticate, userController.updateProfile);
router.get('/me/stats', authenticate, userController.getStats);
router.put('/me/password', authenticate, userController.changePassword);

// ============================================
// ADMIN ROUTES
// ============================================

router.get('/', authenticate, requireAdmin, userController.listUsers);
router.put('/:id/role', authenticate, requireAdmin, userController.updateUserRole);
router.delete('/:id', authenticate, requireAdmin, userController.deactivateUser);

// ============================================
// EXPORT
// ============================================

export default router;