// 
// Decompiled by Procyon v0.6.0
// 

package io.sentry.config;

import org.jetbrains.annotations.NotNull;
import java.util.Properties;
import java.util.List;
import io.sentry.ILogger;
import java.util.ArrayList;
import io.sentry.SystemOutLogger;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public final class PropertiesProviderFactory
{
    @NotNull
    public static PropertiesProvider create() {
        final ILogger logger = new SystemOutLogger();
        final List<PropertiesProvider> providers = new ArrayList<PropertiesProvider>();
        providers.add(new SystemPropertyPropertiesProvider());
        providers.add(new EnvironmentVariablePropertiesProvider());
        final String systemPropertyLocation = System.getProperty("sentry.properties.file");
        if (systemPropertyLocation != null) {
            final Properties properties = new FilesystemPropertiesLoader(systemPropertyLocation, logger).load();
            if (properties != null) {
                providers.add(new SimplePropertiesProvider(properties));
            }
        }
        final String environmentVariablesLocation = System.getenv("SENTRY_PROPERTIES_FILE");
        if (environmentVariablesLocation != null) {
            final Properties properties2 = new FilesystemPropertiesLoader(environmentVariablesLocation, logger).load();
            if (properties2 != null) {
                providers.add(new SimplePropertiesProvider(properties2));
            }
        }
        final Properties properties2 = new ClasspathPropertiesLoader(logger).load();
        if (properties2 != null) {
            providers.add(new SimplePropertiesProvider(properties2));
        }
        final Properties runDirectoryProperties = new FilesystemPropertiesLoader("sentry.properties", logger, false).load();
        if (runDirectoryProperties != null) {
            providers.add(new SimplePropertiesProvider(runDirectoryProperties));
        }
        return new CompositePropertiesProvider(providers);
    }
}
