// routes/userRoutes.js
const express = require("express");
const router = express.Router();
const notificationCotroller = require("../controllers/notificationController");
const authenticate = require("../middlewares/authenticate");
// const authorize = require("../middlewares/authorize");



/**
 * @swagger
 * tags:
 *   name: Notifications
 *   description: Notification management APIs
 */

router.get("/getAll/notifications", authenticate, (req, res) => {
  /*
    #swagger.tags = ['Notifications']
    #swagger.summary = 'Get logged-in user notifications'
    #swagger.security = [{ "bearerAuth": [] }]

    #swagger.responses[200] = {
      description: 'Notifications fetched successfully'
    }

    #swagger.responses[401] = {
      description: 'Unauthorized'
    }
  */
  notificationCotroller.getNotifications(req, res);
});

router.put("/read-all", authenticate, (req, res) => {
  /*
    #swagger.tags = ['Notifications']
    #swagger.summary = 'Mark all notifications as read'
    #swagger.security = [{ "bearerAuth": [] }]

    #swagger.responses[200] = {
      description: 'All notifications marked as read'
    }

    #swagger.responses[401] = {
      description: 'Unauthorized'
    }
  */
  notificationCotroller.markAllAsRead(req, res);
});


router.put("/:id/read", authenticate, (req, res) => {
  /*
    #swagger.tags = ['Notifications']
    #swagger.summary = 'Mark a single notification as read'
    #swagger.security = [{ "bearerAuth": [] }]
    #swagger.parameters['id'] = {
      in: 'path',
      description: 'Notification ID',
      required: true,
      type: 'string'
    }
    #swagger.responses[200] = {
      description: 'Notification marked as read'
    }
  */
  notificationCotroller.markAsRead(req, res);
});



module.exports = router;