using Valg.EVA.Skanning.ContainerExtensions;
using Unity;
using Valg.EVA.Skanning.ServicesModel.ElectionConfig.DataProvider;
using Valg.EVA.Skanning.ServicesModel.Internal;
using Valg.EVA.Skanning.ServicesModel.Internal.CountResult;
using Valg.EVA.Skanning.ServicesModel.Internal.Interpreter;
using Valg.EVA.Skanning.ServicesModel.Internal.SystemSettings;
using Valg.EVA.Skanning.ServicesModel.Internal.UploadWebService;
using Valg.EVA.Skanning.ServicesModel.Internal.Validation;
using Valg.EVA.Skanning.ServicesModel.Internal.Verification;

namespace Valg.EVA.Skanning.ServicesModel
{
    public class UnityInstaller : IUnityInstaller
    {
        public void Install(IUnityContainer unityContainer)
        {
            unityContainer.RegisterType<IBallotPaperMapper, BallotPaperMapper>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ISystemSettingsProvider, SystemSettingsProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IInitialFieldValuesResolver, InitialFieldValuesResolver>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMunicipalityDataProvider, MunicipalityDataProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICandidateListDataProvider, CandidateListDataProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IAffiliationMapper, AffiliationMapper>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IElectionConfigXmlDeserializationHelper, ElectionConfigXmlDeserializationHelper>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IElectionConfigDataProvider, ElectionConfigDataProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMunicipalityDataProvider, MunicipalityDataProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMunicipalitiesCsvReader, MunicipalitiesCsvReader>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ElectionConfigDataPreloader>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IElectionConfigMetadataProvider, ElectionConfigMetadataProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<CastVoteMapper>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<CountingUniqueIdCreator>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBoxContentsInterpreter, BoxContentsInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<BallotNumberInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<BallotIdInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<WriteInInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<CountingOnTopLevelInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<GeneralBallotInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<MultipleStampsInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<PersonalVotingAdjuster>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<FillPercentageRangeCheckerFactory>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IUploadWebServiceFactory, UploadWebServiceFactory>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<BallotHeaderInterpreter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
        }
    }
}
