const express = require("express");
const router = express.Router();
const authMiddleware = require("../middleware/authMiddleware");
const {
  getActionRequired,
  getNotificationCount,
  markAsRead,
  markAllAsRead,
  updateNotificationStatus,
  createNotification,
} = require("../controllers/notifications");

// Get action required notifications for logged-in user
router.get("/action-required", authMiddleware, getActionRequired);

// Get notification count (for badge)
router.get("/count", authMiddleware, getNotificationCount);

// Mark notification as read
router.patch("/:id/read", authMiddleware, markAsRead);

// Mark all notifications as read
router.patch("/read-all", authMiddleware, markAllAsRead);

// Update notification status (pending, in-progress, completed, cancelled)
router.patch("/:id/status", authMiddleware, updateNotificationStatus);

// Create a notification (when assigning tasks)
router.post("/", authMiddleware, createNotification);

module.exports = router;
