import { Router } from "express";
import { ChatController, authenticate } from "../controllers";

export function createChatRoutes(chatController: ChatController): Router {
  const router = Router();

  router.use(authenticate);

  router.post("/message", (req, res) => chatController.sendMessage(req, res));
  router.post("/confirm/:conversationId/:messageId", (req, res) =>
    chatController.confirmEvent(req, res),
  );
  router.post("/reject/:conversationId/:messageId", (req, res) =>
    chatController.rejectEvent(req, res),
  );
  router.get("/conversations", (req, res) =>
    chatController.getConversations(req, res),
  );
  router.get("/conversations/:id", (req, res) =>
    chatController.getConversation(req, res),
  );
  router.put("/messages/:messageId/proposal", (req, res) =>
    chatController.updateProposalEvent(req, res),
  );

  return router;
}
