using Microsoft.AspNetCore.SignalR; using Meezi.API.Hubs; using Meezi.API.Models.Orders; using Meezi.Core.Enums; namespace Meezi.API.Services; public class KdsNotifier : IKdsNotifier { private readonly IHubContext _hubContext; public KdsNotifier(IHubContext hubContext) { _hubContext = hubContext; } public Task NotifyOrderCreatedAsync(string cafeId, LiveOrderDto order, CancellationToken cancellationToken = default) => _hubContext.Clients.Group(KdsHub.GroupName(cafeId)).SendAsync("OrderCreated", order, cancellationToken); public Task NotifyOrderStatusChangedAsync(string cafeId, string orderId, OrderStatus status, CancellationToken cancellationToken = default) => _hubContext.Clients.Group(KdsHub.GroupName(cafeId)).SendAsync("OrderStatusChanged", new { orderId, status }, cancellationToken); public Task NotifyTableStatusChangedAsync(string cafeId, CancellationToken cancellationToken = default) => _hubContext.Clients.Group(KdsHub.GroupName(cafeId)).SendAsync("TableStatusChanged", null, cancellationToken); }