package com.datatheorem.android.trustkit;

import android.content.Context;

import com.datatheorem.android.trustkit.config.PinnedDomainConfig;
import com.datatheorem.android.trustkit.config.TrustKitConfig;
import com.datatheorem.android.trustkit.report.BackgroundReporter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

public class TrustKit {
    private static final String DEFAULT_REPORT_URI
            = "https://overmind.datatheorem.com/trustkit/report";
    private Context appContext;
    private TrustKitConfig trustKitConfig;
    private static TrustKit trustKitInstance;

    private TrustKit(Context context, TrustKitConfig trustKitConfig) {
        this.appContext = context;
        this.trustKitConfig = trustKitConfig;
    }

    public static TrustKit getInstance() {
        return trustKitInstance;
    }


    public static void init(Context appContext, TrustKitConfig trustKitConfig) {
        if (trustKitInstance == null) {
            trustKitInstance = new TrustKit(appContext, trustKitConfig);
        }

//        BackgroundReporter backgroundReporter = new BackgroundReporter(false, "test-id");
//        for (Map.Entry<String, PinnedDomainConfig> pinnedDomainConfig : trustKitConfig.entrySet()) {
//
//
////            reportUris.addAll(Arrays.asList(pinnedDomainConfig.getValue().getReportURIs()));
//            backgroundReporter.pinValidationFailed(pinnedDomainConfig.getKey(), 0, new String[]{},
//                    pinnedDomainConfig.getKey(), pinnedDomainConfig.getValue().getReportURIs(),
//                    pinnedDomainConfig.getValue().isDisableDefaultReportUri(),
//                    pinnedDomainConfig.getValue().isIncludeSubdomains(),
//                    pinnedDomainConfig.getValue().isEnforcePinning(),
//                    pinnedDomainConfig.getValue().getPublicKeyHashes(),
//                    PinValidationResult.PIN_VALIDATION_RESULT_FAILED);
//        }


    }

    public Context getAppContext() {
        return appContext;
    }

}

@@ -371,124 +371,8 @@
 t %7B%0A
-    private static final String DEFAULT_REPORT_URI%0A            = %22https://overmind.datatheorem.com/trustkit/report%22;
 %0A   
@@ -942,892 +942,8 @@
  %7D%0A%0A
-//        BackgroundReporter backgroundReporter = new BackgroundReporter(false, %22test-id%22);%0A//        for (Map.Entry%3CString, PinnedDomainConfig%3E pinnedDomainConfig : trustKitConfig.entrySet()) %7B%0A//%0A//%0A////            reportUris.addAll(Arrays.asList(pinnedDomainConfig.getValue().getReportURIs()));%0A//            backgroundReporter.pinValidationFailed(pinnedDomainConfig.getKey(), 0, new String%5B%5D%7B%7D,%0A//                    pinnedDomainConfig.getKey(), pinnedDomainConfig.getValue().getReportURIs(),%0A//                    pinnedDomainConfig.getValue().isDisableDefaultReportUri(),%0A//                    pinnedDomainConfig.getValue().isIncludeSubdomains(),%0A//                    pinnedDomainConfig.getValue().isEnforcePinning(),%0A//                    pinnedDomainConfig.getValue().getPublicKeyHashes(),%0A//                    PinValidationResult.PIN_VALIDATION_RESULT_FAILED);%0A//        %7D%0A
 %0A%0A  

fix bad reset