using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace TrafficLights.Pages
{
    public class GetStatusModel : PageModel
    {
        private readonly TrafficLightSimulatorService _trafficLightSimulatorService;
        public GetStatusModel(TrafficLightSimulatorService trafficLightSimulatorService)
        {
            _trafficLightSimulatorService = trafficLightSimulatorService; 
        }
        public IActionResult OnGet()
        {
            var currentStatus = _trafficLightSimulatorService.GetStatus();
            return new JsonResult(currentStatus);
        }
    }
}
