using System.Collections.Generic;
using Valg.EVA.Skanning.Entity.ReadModel;
using Valg.EVA.Skanning.Entity.SqlConnection;

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

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

        public IEnumerable<XmlResult> GetAffiliations(string electionEventId, string contestIdentifier)
        {
            return factory.SP_GetList<XmlResult>("ElectionConfig_GetAffiliationList", new { ElectionEventId = electionEventId, ContestId = contestIdentifier });
        }

        public IEnumerable<XmlResult> GetPollingDistricts(string electionEventId)
        {
            return factory.SP_GetList<XmlResult>("ElectionConfig_GetPollingDistrict", new { ElectionEventId = electionEventId });
        }
    }
}
