package com.adealink.weparty.media

import android.content.Context
import com.adealink.frame.base.IError
import com.adealink.frame.base.Rlt
import com.adealink.frame.media.config.IMediaConfig
import com.adealink.frame.media.data.RtcType
import com.adealink.frame.media.rtc.IRtcCallback
import com.adealink.frame.media.rtc.IRtcEngine
import com.adealink.weparty.App

object MediaConfig : IMediaConfig {

    override val context: Context
        get() = App.instance
    override val lowBitrate: Boolean
        get() = false

    override fun createRtcEngine(rtcType: RtcType, callback: IRtcCallback): IRtcEngine? {
        val rtcEngine = when (rtcType) {
            RtcType.AGORA_RTC -> {
//                val appId = if (AppBase.isProdEnv) {
//                    BuildConfig.AGORA_APP_ID
//                } else {
//                    BuildConfig.AGORA_APP_ID
//                }
//                AgoraRtcEngine(RtcConfig(appId, context, rtcLogPath), callback)
                null
            }

            RtcType.T_RTC -> {
//                val appId = if (AppBase.isProdEnv) {
//                    BuildConfig.TRTC_APP_ID
//                } else {
//                    BuildConfig.TRTC_APP_ID_DEBUG
//                }
//                TRtcProEngine(RtcConfig(appId.toString(), context, rtcLogPath), callback)
                null
            }

            RtcType.VOLC_RTC -> null

            RtcType.ZEGO_RTC -> null
        }
        return rtcEngine
    }

    override suspend fun getChannelToken(channel: String, rtcType: RtcType): Rlt<String> {
        return Rlt.Failed(IError("Unsupported"))
    }

    override fun onRTCQualityBad() {

    }

    override fun onRTCQualityGood() {

    }

}