namespace Equibles.AgentQL.EntityFrameworkCore.Query.ReadOnly;

internal static class ReadOnlySessionEnforcerFactory
{
    public static IReadOnlySessionEnforcer Resolve(string providerName)
    {
        var name = (providerName ?? string.Empty).ToLowerInvariant();

        if (name.Contains("npgsql") || name.Contains("postgresql"))
            return PostgreSqlReadOnlySessionEnforcer.Instance;

        if (name.Contains("sqlite"))
            return SqliteReadOnlySessionEnforcer.Instance;

        if (name.Contains("sqlserver"))
            return SqlServerReadOnlySessionEnforcer.Instance;

        if (name.Contains("mysql") || name.Contains("pomelo"))
            return MySqlReadOnlySessionEnforcer.Instance;

        if (name.Contains("oracle"))
            return OracleReadOnlySessionEnforcer.Instance;

        return NullReadOnlySessionEnforcer.Instance;
    }
}
