using EVCB_OCPP.Domain.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace EVCB_OCPP.WSServer.Helper;

public static class AddPortalDbContext
{
    public static IServiceCollection AddWebDBConetext(this IServiceCollection services, IConfiguration configuration)
    {
        const string DbUserIdKey = "WebDbUserId";
        const string DbPassKey = "WebDbPass";
        const string DbConnectionStringKey = "WebDBContext";

        var conneciotnString = configuration.GetConnectionString(DbUserIdKey, DbPassKey, DbConnectionStringKey);
        services.AddSqlConnectionFactory<WebDBConetext>(conneciotnString);
        return services;
    }

    public static IServiceCollection AddOnlineLogDBContext(this IServiceCollection services, IConfiguration configuration)
    {
        const string DbUserIdKey = "OnlineLogDbUserId";
        const string DbPassKey = "OnlineLogDbPass";
        const string DbConnectionStringKey = "OnlineLogDBContext";

        var conneciotnString = configuration.GetConnectionString(DbUserIdKey, DbPassKey, DbConnectionStringKey);
        services.AddSqlConnectionFactory<OnlineLogDBContext>(conneciotnString);
        return services;
    }
}

/// <summary>
/// Dummy
/// </summary>
public class WebDBConetext : DbContext {}

/// <summary>
/// Dummy
/// </summary>
public class OnlineLogDBContext : DbContext { }