using Codex.Dal.Services;
using Microsoft.Extensions.DependencyInjection;
using OpenHarbor.CQRS.DynamicQuery.Abstractions;
using PoweredSoft.Data.Core;
using PoweredSoft.Module.Abstractions;

namespace Codex.Dal;

public class DalModule : IModule
{
    public IServiceCollection ConfigureServices(IServiceCollection services)
    {
        services.AddSingleton<IAsyncQueryableHandlerService, InMemoryQueryableHandlerService>();
        services.AddTransient(typeof(IQueryableProvider<>), typeof(DefaultQueryableProvider<>));
        services.AddSingleton<IEncryptionService, AesEncryptionService>();

        // Register dynamic queries (paginated)
        services.AddDynamicQueries();

        return services;
    }
}

