package com.idvlibrary

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import com.idvlibrary.IdvLibraryModule


class IdvLibraryPackage : BaseReactPackage() {
  override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
    return if (name == IdvModuleImpl.NAME) {
      IdvLibraryModule(reactContext)
    } else {
      null
    }
  }

  override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
    mapOf(
      IdvModuleImpl.NAME to ReactModuleInfo(
        name = IdvModuleImpl.NAME,
        className = IdvModuleImpl.NAME,
        canOverrideExistingModule = false,
        needsEagerInit = false,
        true,
        isCxxModule = false,
        isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
      )
    )
  }
}
