using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MilliSim.Common.Dtos; using MilliSim.Common.Models; using MilliSim.Services; namespace MilliSim.Controllers; [ApiController] [Route("api/notifications")] [Authorize] public class NotificationsController : ControllerBase { private readonly INotificationService _notificationService; public NotificationsController(INotificationService notificationService) { _notificationService = notificationService; } [HttpGet] public async Task>> GetNotifications([FromQuery] NotificationType? type, [FromQuery] PageRequest request) { return await _notificationService.GetNotificationsAsync(type, request); } [HttpGet("unread-count")] public async Task> GetUnreadCount() { return await _notificationService.GetUnreadCountAsync(); } [HttpPost("{id}/read")] public async Task MarkAsRead(long id) { return await _notificationService.MarkAsReadAsync(id); } [HttpPost("read-all")] public async Task MarkAllAsRead() { return await _notificationService.MarkAllAsReadAsync(); } [HttpPost("{id}/delete")] public async Task DeleteNotification(long id) { return await _notificationService.DeleteNotificationAsync(id); } }