package com.humand.demo.modules.LivestreamService

import com.facebook.react.TurboReactPackage
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.facebook.react.uimanager.ViewManager
import com.humand.demo.BuildConfig

/**
 * React Native package for LivestreamService module.
 */
class LivestreamServicePackage : TurboReactPackage() {

    override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
        return when (name) {
            RNLivestreamManager.NAME -> RNLivestreamManager(reactContext)
            else -> null
        }
    }

    override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
        return emptyList()
    }

    override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
        val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
        return ReactModuleInfoProvider {
            mapOf(
                RNLivestreamManager.NAME to ReactModuleInfo(
                    RNLivestreamManager.NAME,
                    RNLivestreamManager.NAME,
                    false,
                    false,
                    true,
                    false,
                    isTurboModule
                )
            )
        }
    }
}
