import { configInfo } from '../config.js';
import { LogError, LogStatus } from '@memberjunction/core';
import { AuthProviderFactory } from './AuthProviderFactory.js';
export function initializeAuthProviders() {
    const factory = AuthProviderFactory.getInstance();
    factory.clear();
    if (configInfo.authProviders && configInfo.authProviders.length > 0) {
        for (const providerConfig of configInfo.authProviders) {
            try {
                const provider = AuthProviderFactory.createProvider(providerConfig);
                factory.register(provider);
                LogStatus(`Registered auth provider: ${provider.name} (type: ${providerConfig.type})`);
            }
            catch (error) {
                LogError(`Failed to initialize auth provider ${providerConfig.name}: ${error}`);
            }
        }
    }
    if (!factory.hasProviders()) {
        LogError('No authentication providers configured. Please configure authProviders array in mj.config.cjs');
    }
}
//# sourceMappingURL=initializeProviders.js.map