using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using MTWorkHR.Infrastructure.EmailService;
using MTWorkHR.Infrastructure.Logging;
using MTWorkHR.Core.Global;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using MTWorkHR.Core.IRepositories.Base;
using MTWorkHR.Core.IRepositories;
using MTWorkHR.Core.UnitOfWork;

using MTWorkHR.Infrastructure.Data;
using MTWorkHR.Infrastructure.Repositories;
using MTWorkHR.Infrastructure.UnitOfWorks;
using MTWorkHR.Core.Email;


namespace MTWorkHR.Infrastructure
{
    public static class InfrastructureServiceRegistration
    {
        public static IServiceCollection AddInfrastructureServices (this IServiceCollection services, AppSettingsConfiguration configuration){
            services.AddDbContext<HRDataContext>(options => {
                options.UseSqlServer(configuration.ConnectionStrings.MTWorkHRConnectionString);
            });

            //services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
            //services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>));
            //services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository));

            //services.AddScoped(typeof(IProjectRepository), typeof(ProjectRepository));
            //services.AddScoped(typeof(ITaskStatusRepository), typeof(TaskStatusRepository));
            //services.AddScoped(typeof(IUserTaskRepository), typeof(UserTaskRepository));
            //services.AddScoped(typeof(IUserTaskHistoryRepository), typeof(UserTaskHistoryRepository));



            //services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository));
            //services.AddScoped(typeof(IRolePermissionRepository<RolePermission>), typeof(RolePermissionRepository));
            //services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));

            //services.AddScoped<IUnitOfWork, UnitOfWork>();
            //services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
            //services.AddTransient<IMailSender, MailSender>();

            //services.AddScoped<ApplicationUserManager>();
            //services.AddScoped<GlobalInfo>();

            //services.AddScoped<IEmployeeRepository, EmployeeRepository>();

            //services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
            return services;
        }
    }
}
