import express from 'express';
import { authMiddleware } from '../middlewares/authMiddleware.js';

export function createUserRoutes(container) {
  const router = express.Router();
  const userController = container.resolve('UserController');
  const jwtService = container.resolve('JwtService');

  // Protected routes
  router.get('/me', authMiddleware(jwtService), (req, res, next) => userController.getMe(req, res, next));
  router.get('/', authMiddleware(jwtService), (req, res, next) => userController.getAllUsers(req, res, next));
  router.get('/:id', authMiddleware(jwtService), (req, res, next) => userController.getUserById(req, res, next));
  router.put('/profile', authMiddleware(jwtService), (req, res, next) => userController.updateProfile(req, res, next));

  return router;
}
