//
// FaceTec Device SDK config file.
// Auto-generated via the FaceTec SDK Configuration Wizard
//

package Processors;

import android.content.Context;
import android.graphics.Color;
import android.util.Log;

import com.facetec.sdk.*;
import com.reactnativefacetec.R;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReadableMap;


public class Config {
  /*public static String ProductionKey = "appId = \"*\"\n" +
    "expiryDate = 2025-03-10\n" +
    "key = 00304402203b505e471daac90237549e993584783378da62211300097fbccafd26480c8d4602204f6ec4f560175263701c070342ac6f1f841d8f5299fc0bc2206d84a552f911e";*/

  // -------------------------------------
  // REQUIRED
  // Available at https://dev.facetec.com/account
  // NOTE: This field is auto-populated by the FaceTec SDK Configuration Wizard.
  //public static String DeviceKeyIdentifier = "d0YgeQZv73PZ1eeaWJS64NGPCU0lplOY";
  //public static String DeviceKeyIdentifier = "dMtZOj5ypMEUk4XtasRNpWVC0lLUDyqk";

  // -------------------------------------
  // REQUIRED
  // The URL to call to process FaceTec SDK Sessions.
  // In Production, you likely will handle network requests elsewhere and without the use of this variable.
  // See https://dev.facetec.com/security-best-practices?link=facetec-server-rest-endpoint-security for more information.
  // NOTE: This field is auto-populated by the FaceTec SDK Configuration Wizard.
  //public static String BaseURL = "https://facetec-appvt.veritran.com";
  public static String BaseURL = "https://api.facetec.com/api/v3.1/biometrics";

  // -------------------------------------
  // REQUIRED
  // The FaceScan Encryption Key you define for your application.
  // Please see https://dev.facetec.com/facemap-encryption-keys for more information.
  // NOTE: This field is auto-populated by the FaceTec SDK Configuration Wizard.
  /*static String PublicFaceScanEncryptionKey =
    "-----BEGIN PUBLIC KEY-----\n" +
      "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5PxZ3DLj+zP6T6HFgzzk\n" +
      "M77LdzP3fojBoLasw7EfzvLMnJNUlyRb5m8e5QyyJxI+wRjsALHvFgLzGwxM8ehz\n" +
      "DqqBZed+f4w33GgQXFZOS4AOvyPbALgCYoLehigLAbbCNTkeY5RDcmmSI/sbp+s6\n" +
      "mAiAKKvCdIqe17bltZ/rfEoL3gPKEfLXeN549LTj3XBp0hvG4loQ6eC1E1tRzSkf\n" +
      "GJD4GIVvR+j12gXAaftj3ahfYxioBH7F7HQxzmWkwDyn3bqU54eaiB7f0ftsPpWM\n" +
      "ceUaqkL2DZUvgN0efEJjnWy5y1/Gkq5GGWCROI9XG/SwXJ30BbVUehTbVcD70+ZF\n" +
      "8QIDAQAB\n" +
      "-----END PUBLIC KEY-----"
    ;*/

  static String PublicFaceScanEncryptionKey =
    "-----BEGIN PUBLIC KEY-----\n" +
      "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5PxZ3DLj+zP6T6HFgzzk\n" +
      "M77LdzP3fojBoLasw7EfzvLMnJNUlyRb5m8e5QyyJxI+wRjsALHvFgLzGwxM8ehz\n" +
      "DqqBZed+f4w33GgQXFZOS4AOvyPbALgCYoLehigLAbbCNTkeY5RDcmmSI/sbp+s6\n" +
      "mAiAKKvCdIqe17bltZ/rfEoL3gPKEfLXeN549LTj3XBp0hvG4loQ6eC1E1tRzSkf\n" +
      "GJD4GIVvR+j12gXAaftj3ahfYxioBH7F7HQxzmWkwDyn3bqU54eaiB7f0ftsPpWM\n" +
      "ceUaqkL2DZUvgN0efEJjnWy5y1/Gkq5GGWCROI9XG/SwXJ30BbVUehTbVcD70+ZF\n" +
      "8QIDAQAB\n" +
      "-----END PUBLIC KEY-----"
    ;


  // -------------------------------------
  // Convenience method to initialize the FaceTec SDK.
  // NOTE: This function is auto-populated by the FaceTec SDK Configuration Wizard based on the Keys issued to your Apps.

  public static void initializeFaceTecSDKFromAutogeneratedConfig(String DeviceKey, Context context, FaceTecSDK.InitializeCallback callback) {
    Log.d("INICIPU", "CONFIG");
    /*FaceTecSDK.initializeInProductionMode(context, ProductionKey, DeviceKeyIdentifier, PublicFaceScanEncryptionKey, new FaceTecSDK.InitializeCallback(){
      @Override
      public void onCompletion(boolean success) {
        if (success) {
          Log.d("INICIPU", "COMPLETION");
          promise.resolve(true);
        } else {
          Log.d("INICIPU", "NO COMPLETION");
        }
      }
    });*/

    FaceTecSDK.initializeInDevelopmentMode(context, DeviceKey, PublicFaceScanEncryptionKey, callback);

    Log.d("INICIPU", "POST CONFIG");
  }


  // -------------------------------------
  // This app can modify the customization to demonstrate different look/feel preferences
  // NOTE: This function is auto-populated by the FaceTec SDK Configuration Wizard based on your UI Customizations you picked in the Configuration Wizard GUI.
  public static FaceTecCustomization retrieveConfigurationWizardCustomization(ReadableMap colors) {
    Log.d("INICIPU", "ENTRA CUSTOM");

    // For Color Customization
    int outerBackgroundColor = colors.hasKey("outerBackgroundColor") ? Color.parseColor(colors.getString("outerBackgroundColor")) : Color.parseColor("#ffffff");
    int frameColor = colors.hasKey("frameColor") ? Color.parseColor(colors.getString("frameColor")) : Color.parseColor("#ffffff");
    int borderColor = colors.hasKey("borderColor") ? Color.parseColor(colors.getString("borderColor")) : Color.parseColor("#417FB2");
    int ovalColor = colors.hasKey("ovalColor") ? Color.parseColor(colors.getString("ovalColor")) : Color.parseColor("#417FB2");
    int dualSpinnerColor = colors.hasKey("dualSpinnerColor") ? Color.parseColor(colors.getString("dualSpinnerColor")) : Color.parseColor("#417FB2");
    int textColor = colors.hasKey("textColor") ? Color.parseColor(colors.getString("textColor")) : Color.parseColor("#417FB2");
    int buttonAndFeedbackBarColor = colors.hasKey("buttonAndFeedbackBarColor") ? Color.parseColor(colors.getString("buttonAndFeedbackBarColor")) : Color.parseColor("#417FB2");
    int buttonAndFeedbackBarTextColor = colors.hasKey("buttonAndFeedbackBarTextColor") ? Color.parseColor(colors.getString("buttonAndFeedbackBarTextColor")) : Color.parseColor("#ffffff");
    int buttonColorHighlight = colors.hasKey("buttonColorHighlight") ? Color.parseColor(colors.getString("buttonColorHighlight")) : Color.parseColor("#396E99");
    int buttonColorDisabled = colors.hasKey("buttonColorDisabled") ? Color.parseColor(colors.getString("buttonColorDisabled")) : Color.parseColor("#B9CCDE");

    // For Frame Corner Radius Customization
    int frameCornerRadius = 20;

    // For Cancel Button Customization
    int cancelButtonImage = R.drawable.facetec_cancel;
    FaceTecCancelButtonCustomization.ButtonLocation cancelButtonLocation = FaceTecCancelButtonCustomization.ButtonLocation.TOP_LEFT;

    // For image Customization
    int yourAppLogoImage = R.drawable.facetec_your_app_logo;
    FaceTecSecurityWatermarkImage securityWatermarkImage = FaceTecSecurityWatermarkImage.FACETEC;


    // Set a default customization
    FaceTecCustomization defaultCustomization = new FaceTecCustomization();


    // Set Frame Customization
    defaultCustomization.getFrameCustomization().cornerRadius = frameCornerRadius;
    defaultCustomization.getFrameCustomization().backgroundColor = frameColor;
    defaultCustomization.getFrameCustomization().borderColor = borderColor;

    // Set Overlay Customization
    defaultCustomization.getOverlayCustomization().brandingImage = yourAppLogoImage;
    defaultCustomization.getOverlayCustomization().backgroundColor = outerBackgroundColor;

    // Set Guidance Customization
    defaultCustomization.getGuidanceCustomization().backgroundColors = frameColor;
    defaultCustomization.getGuidanceCustomization().foregroundColor = textColor;
    defaultCustomization.getGuidanceCustomization().buttonBackgroundNormalColor = buttonAndFeedbackBarColor;
    defaultCustomization.getGuidanceCustomization().buttonBackgroundDisabledColor = buttonColorDisabled;
    defaultCustomization.getGuidanceCustomization().buttonBackgroundHighlightColor = buttonColorHighlight;
    defaultCustomization.getGuidanceCustomization().buttonTextNormalColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getGuidanceCustomization().buttonTextDisabledColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getGuidanceCustomization().buttonTextHighlightColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getGuidanceCustomization().retryScreenImageBorderColor = borderColor;
    defaultCustomization.getGuidanceCustomization().retryScreenOvalStrokeColor = borderColor;

    // Set Oval Customization
    defaultCustomization.getOvalCustomization().strokeColor = ovalColor;
    defaultCustomization.getOvalCustomization().progressColor1 = dualSpinnerColor;
    defaultCustomization.getOvalCustomization().progressColor2 = dualSpinnerColor;

    // Set Feedback Customization
    defaultCustomization.getFeedbackCustomization().backgroundColors = buttonAndFeedbackBarColor;
    defaultCustomization.getFeedbackCustomization().textColor = buttonAndFeedbackBarTextColor;

    // Set Cancel Customization
    defaultCustomization.getCancelButtonCustomization().customImage = cancelButtonImage;
    defaultCustomization.getCancelButtonCustomization().setLocation(cancelButtonLocation);

    // Set Result Screen Customization
    defaultCustomization.getResultScreenCustomization().backgroundColors = frameColor;
    defaultCustomization.getResultScreenCustomization().foregroundColor = textColor;
    defaultCustomization.getResultScreenCustomization().activityIndicatorColor = buttonAndFeedbackBarColor;
    defaultCustomization.getResultScreenCustomization().resultAnimationBackgroundColor = buttonAndFeedbackBarColor;
    defaultCustomization.getResultScreenCustomization().resultAnimationForegroundColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getResultScreenCustomization().uploadProgressFillColor = buttonAndFeedbackBarColor;

    // Set Security Watermark Customization
    defaultCustomization.securityWatermarkImage = securityWatermarkImage;

    // Set ID Scan Customization
    defaultCustomization.getIdScanCustomization().selectionScreenBackgroundColors = frameColor;
    defaultCustomization.getIdScanCustomization().selectionScreenForegroundColor = textColor;
    defaultCustomization.getIdScanCustomization().reviewScreenBackgroundColors = frameColor;
    defaultCustomization.getIdScanCustomization().reviewScreenForegroundColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getIdScanCustomization().reviewScreenTextBackgroundColor = buttonAndFeedbackBarColor;
    defaultCustomization.getIdScanCustomization().captureScreenForegroundColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getIdScanCustomization().captureScreenTextBackgroundColor = buttonAndFeedbackBarColor;
    defaultCustomization.getIdScanCustomization().buttonBackgroundNormalColor = buttonAndFeedbackBarColor;
    defaultCustomization.getIdScanCustomization().buttonBackgroundDisabledColor = buttonColorDisabled;
    defaultCustomization.getIdScanCustomization().buttonBackgroundHighlightColor = buttonColorHighlight;
    defaultCustomization.getIdScanCustomization().buttonTextNormalColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getIdScanCustomization().buttonTextDisabledColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getIdScanCustomization().buttonTextHighlightColor = buttonAndFeedbackBarTextColor;
    defaultCustomization.getIdScanCustomization().captureScreenBackgroundColor = frameColor;
    defaultCustomization.getIdScanCustomization().captureFrameStrokeColor = borderColor;


    return defaultCustomization;
  }


  public static FaceTecCustomization retrieveLowLightConfigurationWizardCustomization(ReadableMap colors) {
    return retrieveConfigurationWizardCustomization(colors);
  }


  public static FaceTecCustomization retrieveDynamicDimmingConfigurationWizardCustomization(ReadableMap colors) {
    return retrieveConfigurationWizardCustomization(colors);
  }


  //public static FaceTecCustomization currentCustomization = retrieveConfigurationWizardCustomization();
  //public static FaceTecCustomization currentLowLightCustomization = retrieveLowLightConfigurationWizardCustomization();
  //public static FaceTecCustomization currentDynamicDimmingCustomization = retrieveDynamicDimmingConfigurationWizardCustomization();

  // -------------------------------------
  // Boolean to indicate the FaceTec SDK Configuration Wizard was used to generate this file.
  // In this Sample App, if this variable is true, a "Config Wizard Theme" will be added to this App's Design Showcase,
  // and choosing this option will set the FaceTec SDK UI/UX Customizations to the Customizations that you selected in the
  // Configuration Wizard.
  public static boolean wasSDKConfiguredWithConfigWizard = true;

}
