using Microsoft.AspNetCore.SignalR;
using System.Diagnostics;
using TrafficLightsSignalR.Schema;

namespace TrafficLightsSignalR.Hubs
{
    public class LightHub(ITrafficLightStateService stateService) : Hub
    {
        private readonly ITrafficLightStateService _stateService = stateService;

        public async Task GetServerState(string connectionId)
        {
            await Clients.Client(connectionId).SendAsync("ReceiveServerState", _stateService.GetCurrentTrafficLightState());
        }
    }
}
