using NEXUS.Data.Dtos;
using NEXUS.Data.Entities;
using NEXUS.Data.IRepositories;

namespace NEXUS.Data.Repositories
{
    public class MorbidityPM25Repository : SqliteRepository<T_MorbidityPM25>, IMorbidityPM25Repository
    {
        private const string sql1 = "SELECT GeoId11 FROM T_Morbidity_PM25 WHERE Year=@Year AND EndpointId=@EndpointId AND IncidencesPercentile>=@Min";
        private const string sql2 = "SELECT GeoId11 FROM T_Morbidity_PM25 WHERE Year=@Year AND EndpointId=@EndpointId AND IncidencesPer10K>=@Min";

        public MorbidityPM25Repository(DefaultDbConnectionInfo dbConnectionInfo) : base(dbConnectionInfo)
        {
        }

        public Task<IEnumerable<string>> QueryGeoId11ByMinPercentileAsync(Year year, int endpointId, float min)
        {
            return base.QueryAsync<string>(sql1, new { Year = year, EndpointId = endpointId, Min = min });
        }

        public Task<IEnumerable<string>> QueryGeoId11ByMinValueAsync(Year year, int endpointId, double min)
        {
            return base.QueryAsync<string>(sql2, new { Year = year, EndpointId = endpointId, Min = min });
        }
    }
}