using Valg.EVA.Skanning.ServicesModel.Internal;
using Valg.EVA.Skanning.ServicesModel.Internal.BallotNumber;

namespace Valg.EVA.Skanning.ServicesModel.ElectionConfig.DataProvider
{
    public static class CandidateListDataProviderExtensions
    {
        public static bool AffiliationExistsInContest(this ICandidateListDataProvider dataProvider, string barcodeLong, string ballotNumber)
        {
            var affiliation = dataProvider.GetAffiliation(barcodeLong.GetElectionEventIdFromBarcodeLong(),
                barcodeLong.GetContestIdFromBarcodeLong(),
                ballotNumber.AffiliationShortCode());
            return affiliation != null;
        }
    }
}
