using GB5Shared.DTO.Framework.Login; using Microsoft.AspNetCore.SignalR; using PERMBLL.Interfaces; using PERMDAL.DTOs; using PERMSL.Hubs; namespace PERMSL.Infrastructure; public class PermNotificationService : IPermNotificationService { private readonly IHubContext _hub; public PermNotificationService( IHubContext hub) => _hub = hub; public async Task NotifyAppraisalStatusChangedAsync( int appraisalId, int employeeId, short status, LoginDTO login, CancellationToken ct) { var group = $"perm:user:{employeeId}"; var label = status switch { 2 => "Accepted", 3 => "Rejected", 4 => "Finalized", _ => status.ToString() }; await _hub.Clients.Group(group).ReceiveAppraisalUpdate(new AppraisalUpdateNotificationDTO { AppraisalId = appraisalId, Status = status, StatusLabel = label }); } }