using Valg.EVA.Skanning.Entity.SqlConnection;

namespace Valg.EVA.Skanning.Repositories.ElectionConfig
{
    public class MunicipalityRepository : IMunicipalityRepository
    {
        private readonly ISqlConnectionFactory factory;

        public MunicipalityRepository(ISqlConnectionFactory factory)
        {
            this.factory = factory;
        }

        public string GetMunicipalities(string electionEventId)
        {
            var data = factory.SP_Get("ElectionConfig_GetMunicipalityList", new {ElectionEventId = electionEventId});
            if (data != null)
            {
                return data.CsvContent;
            }

            return string.Empty;
        }
    }
}
