package com.idvlibrary

import com.facebook.react.bridge.Callback
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap
import com.idv.identity.platform.api.IdentityPlatform
import com.idvlibrary.IdvModuleImpl

class IdvLibraryModule(reactContext: ReactApplicationContext) :
  ReactContextBaseJavaModule(reactContext) {


  // declare an instance of the implementation and use it in all the methods
  private var impl: IdvModuleImpl = IdvModuleImpl()


  @ReactMethod
  fun getMetaInfo(promise: Promise?) {
    impl.getMetaInfo(reactApplicationContext, promise)
  }

  @ReactMethod
  fun install(promise: Promise?) {
    impl.install(reactApplicationContext,promise)
  }

  @ReactMethod
  fun installWithOptions(options: ReadableMap?,promise: Promise?) {
    impl.installWithOptions(reactApplicationContext, options,promise)
  }

  @ReactMethod
  fun verify(
    transactionId: String?,
    extParams: ReadableMap?,
    promise: Promise?
  ) {
    impl.verify(
      transactionId, extParams, promise
    )
  }

  @ReactMethod
  fun setCustomUIConfig(param: String?, promise: Promise?) {
    impl.setCustomUIConfig(param, promise)

  }

  override fun getName(): String = IdvModuleImpl.NAME

  companion object {
    const val NAME = IdvModuleImpl.NAME
  }
}
