import express from 'express';
import { sendMessage, getUnreadMessages, markMessageAsRead, getMyPendingMessages, deleteMessage, archiveMessage, recipientDeleteMessage } from '../controllers/messageController.js';
import {  } from '../middleware/authMiddleware.js';

const router = express.Router();

// All routes require authentication
router.post('/', sendMessage);
router.get('/unread', getUnreadMessages);
router.get('/pending', getMyPendingMessages);
router.patch('/:id/read', markMessageAsRead);
router.patch('/:id/archive', archiveMessage);
router.delete('/:id', deleteMessage); // Sender side (if unread)
router.delete('/:id/recipient', recipientDeleteMessage); // Recipient side

export default router;
