import { Router } from 'express';
import ChatController from '../controllers/chatController.js';
import { authenticate } from '../middleware/authMiddleware.js';

const router = Router();
const chatController = new ChatController();

router.get('/messages', chatController.getMessages);
router.post('/findMatch', chatController.findRandomChatMatch);
router.post('/register', chatController.registerUser);
router.post('/sendMessage', chatController.sendMessage);
router.post('/leave', chatController.stopChat);
router.post('/exit', chatController.removeUser);
router.post('/initOneToOne', authenticate, chatController.initOneToOne);
router.post('/oneToOne/sendMessage', authenticate, chatController.sendOneToOneMessage); // Neue Route zum Senden einer Nachricht
router.get('/oneToOne/messageHistory', authenticate, chatController.getOneToOneMessageHistory); // Neue Route zum Abrufen der Nachrichtengeschichte
router.get('/rooms', chatController.getRoomList);

export default router;
