using Interfaces;
using Nancy;

namespace RaceLapTimer.ApiControllers
{
    public class MonitorApiModule : NancyModule
    {
        private IDbProvider _provider;
        public MonitorApiModule(IDbProvider provider) : base("api/monitor")
        {
            _provider = provider;

            Get[""] = args => GetRootMonitorData();
        }

        private dynamic GetRootMonitorData()
        {
            return Response.AsJson(new { data = _provider.GetRaceSessions(true)});
        }
    }
}
