package com.idvlibrary

import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableMap
import com.idv.identity.platform.api.IdentityPlatform

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

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


  override fun getMetaInfo(promise: Promise?) {
    println("getMetaInfo:${IdentityPlatform.getMetaInfo(reactApplicationContext)}")
     impl.getMetaInfo(reactApplicationContext, promise)
  }

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

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

  override fun verify(certifyId: String, extParams: ReadableMap, promise: Promise) {
    impl.verify(certifyId, extParams, promise)
  }

  override fun setCustomUIConfig(
    param: String?,
    promise: Promise?
  ) {
    impl.setCustomUIConfig(param,promise)
  }


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