// IRU Notification API Routes
// Routes for notifications

import { Router } from 'express';
import { notificationService } from '@/core/iru/notifications/notification.service';
import { zeroTrustAuthMiddleware } from '@/integration/api-gateway/middleware/auth.middleware';
import { adminPermissionMiddleware } from '@/integration/api-gateway/middleware/admin-permission.middleware';

const router = Router();

// All notification routes require authentication
router.use(zeroTrustAuthMiddleware);

/**
 * @route POST /api/v1/iru/notifications/send
 * @desc Send notification
 * @access Authenticated
 */
router.post('/send', async (req, res, next) => {
  try {
    const result = await notificationService.sendNotification(req.body);
    res.json({
      success: result.success,
      data: result,
      timestamp: new Date(),
    });
  } catch (error) {
    return next(error);
  }
});

/**
 * @route GET /api/v1/iru/notifications
 * @desc Get notifications for current user
 * @access Authenticated
 */
router.get('/', async (req, res, next) => {
  try {
    // TODO: Get notifications from database
    const notifications: any[] = [];
    res.json({
      success: true,
      data: notifications,
      timestamp: new Date(),
    });
  } catch (error) {
    return next(error);
  }
});

export default router;
