const express = require("express");
const router = express.Router();
const { authenticate } = require("../middleware/login.middleware.js");
const {
  CreateBot,
  getAllBots,
  getBotByUUID,
  Chat,
  BotMessage,
  getMyBots,
  DeleteBot, // or getMyBots depending on your export
} = require("../controllers/bot.controller.js");

router.get("/chat/:uuid/:threadid/messages", authenticate, BotMessage);
router.post("/chat/:uuid/:threadid", authenticate, Chat);
router.get("/user", authenticate, getMyBots); // ✅ MOVE THIS UP
router.get("/", getAllBots);
router.post("/create", authenticate, CreateBot);
router.get("/:botId", DeleteBot); // ✅ KEEP THIS LAST
router.delete("/:uuid", getBotByUUID); // ✅ KEEP THIS LAST

module.exports = router;
