using Valg.EVA.Skanning.ContainerExtensions;
using Valg.EVA.Skanning.UserInterfaceElements.UserSettingWindow;
using Unity;
using System.Diagnostics.CodeAnalysis;
using Valg.EVA.Skanning.JobManagement.Startup.Data;
using Valg.EVA.Skanning.JobManagement.Startup.DataRefresh;
using Valg.EVA.Skanning.JobManagement.Startup.EmergencyMode;
using Valg.EVA.Skanning.JobManagement.Startup.MainWindow;
using Valg.EVA.Skanning.JobManagement.Startup.UI;
using Valg.EVA.Skanning.JobManagement.Startup.UI.Counting;
using Valg.EVA.Skanning.JobManagement.Startup.UI.Duplicates;
using Valg.EVA.Skanning.JobManagement.Startup.UI.Filter;
using Valg.EVA.Skanning.JobManagement.Startup.UI.Signing;
using Valg.EVA.Skanning.JobManagement.Startup.UI.TransferOverview;
using Valg.EVA.Skanning.JobManagement.Startup.UI.VotingCategories;

namespace Valg.EVA.Skanning.JobManagement.Startup
{
    [ExcludeFromCodeCoverage]
    public class UnityInstaller : IUnityInstaller
    {
        [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
        public void Install(IUnityContainer unityContainer)
        {
            unityContainer.RegisterType<IMainWindowInitializer, MainWindowInitializer>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMainWindow, MainWindow.MainWindow>();
            unityContainer.RegisterType<IMainWindowViewModel, MainWindowViewModel>();      
            unityContainer.RegisterType<IResetEmergencyModeLinkViewModel, ResetEmergencyModeLinkViewModel>();
            unityContainer.RegisterType<IAdditionalSettingsProvider, AdditionalSettingsProvider>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IJobManagementApplication, JobManagementApplication>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMainViewModel, MainViewModel>();
            unityContainer.RegisterType<VotingCategoriesViewModel>();
            unityContainer.RegisterType<ICountingViewModel, CountingViewModel>();
            unityContainer.RegisterType<StartCountingButtonViewModel>();
            unityContainer.RegisterType<StartCountingPopupView>();
            unityContainer.RegisterType<IDataModel, DataModel>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<TransferDetailsViewModel>();
            unityContainer.RegisterType<ISigningErrors, SigningErrors>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ICountingPopups, CountingPopups>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ITransferErrorsPresenter, TransferErrorsPresenter>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IBuypassBootstrapper, BuypassBootstrapper>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<FilterViewModel>();
            unityContainer.RegisterType<BoxViewModel>();
            unityContainer.RegisterType<IDataRefresher, DataRefresher>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ResolveDuplicatesPopupView>();
            unityContainer.RegisterType<ResolveDuplicatesPopupViewModel>();
            unityContainer.RegisterType<TransferViewModel>();
            unityContainer.RegisterType<GenerateBarcodesViewModel>();
            
        }
    }
}
