using Valg.EVA.Skanning.ContainerExtensions;
using Valg.EVA.Skanning.Contracts;
using Unity;
using Unity.Lifetime;

namespace Valg.EVA.Skanning.Configuration
{
    public class UnityInstaller : IUnityInstaller
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
        public void Install(IUnityContainer unityContainer)
        {
            unityContainer.RegisterType<IDiagnosticsConfiguration, DiagnosticsConfiguration>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IReadSoftConfiguration, ReadSoftConfiguration>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IDatabaseConfiguration, EncryptedDatabaseConfiguration>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<IExternalEndpointsConfiguration, ExternalEndpointsConfiguration>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
            unityContainer.RegisterType<ISharedConfigurationManager, SharedConfigurationManager>(ContainerLifetimes.CreateContainerControlledLifetimeManager());
        }
    }
}
