using DigitalData.UserManager.Application;
using DigitalData.UserManager.Infrastructure;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

namespace DigitalData.UserManager.DependencyInjection;

public static class Extensions
{
    public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services) 
        where TDbContext : DbContext, IUserManagerDbContext
    {
        services.AddUserManagerInfrastructure<TDbContext>();
        services.AddUserManagerApplication();
        return services;
    }

    public static IServiceCollection AddUserManager(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction)
    {
        services.AddUserManagerInfrastructure(optionsAction);
        services.AddUserManagerApplication();
        return services;
    }
}
