using Valg.EVA.Skanning.ContainerExtensions;
using Unity;
using Valg.EVA.Skanning.Repositories.BallotPaper;
using Valg.EVA.Skanning.Repositories.Box;
using Valg.EVA.Skanning.Repositories.Counting;
using Valg.EVA.Skanning.Repositories.CountingResult;
using Valg.EVA.Skanning.Repositories.ElectionConfig;
using Valg.EVA.Skanning.Repositories.EmergencyMode;
using Valg.EVA.Skanning.Repositories.System;
using Valg.EVA.Skanning.Repositories.SystemSettings;
using Valg.EVA.Skanning.Repositories.Transfers;

namespace Valg.EVA.Skanning.Repositories
{
    public class UnityInstaller : IUnityInstaller
    {
        [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
        public void Install(IUnityContainer unityContainer)
        {
            unityContainer.RegisterType<ISystemSettingsRepository, SystemSettingsRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBoxRepository, BoxRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICountingWriteableRepository, CountingWriteableRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICountingRepository, CountingRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBallotPaperRepository, BallotPaperRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBallotPaperWritableRepository, BallotPaperWritableRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBallotPaperValuesUpdater, BallotPaperValuesUpdater>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ISystemRepository, SystemRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICountingResultWritableRepository, CountingResultWritableRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICountingResultRepository, CountingResultRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICandidateListRepository, CandidateListRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IElectionEventRepository, ElectionEventRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IElectionConfigMetadataRepository, ElectionConfigMetadataRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMunicipalityRepository, MunicipalityRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IEmergencyModeWriteableRepository, EmergencyModeWriteableRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IEmergencyModeRepository, EmergencyModeRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ITransferRepository, TransferRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ITransferWriteableRepository, TransferWriteableRepository>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
        }
    }
}
