using Autofac;
using e_suite.API.Common;
using e_suite.DependencyInjection;
using e_suite.Service.Performance.Implementations;
using e_suite.Service.Performance.Interfaces;
using e_suite.Service.Performance.Repository;
using Microsoft.Extensions.Caching.Memory;

namespace e_suite.Service.Performance;

public class IocRegistration : IIocRegistration
{
    public void RegisterTypes(ContainerBuilder builder)
    {
        builder.RegisterType<PerformanceCache>().As<IPerformanceCache>().InstancePerLifetimeScope();
        builder.RegisterType<PerformanceRepository>().As<IPerformanceRepository>().InstancePerLifetimeScope();
        builder.RegisterType<Stopwatch>().As<IStopwatch>().InstancePerLifetimeScope();
        builder.RegisterType<PerformanceReportProcessor>().As<IPerformanceReportProcessor>().InstancePerLifetimeScope();
        builder.RegisterType<MemoryCache>().As<IMemoryCache>().SingleInstance();
        builder.RegisterType<PerformanceMaintenance>().As<IPerformanceMaintenance>().InstancePerLifetimeScope();
    }
}