package com.gh.gamecenter.setting

import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ISettingProvider

/**
 * 与设置模块桥接的桥
 */
object SettingBridge {

    private val mSettingProvider by lazy {
        ARouter.getInstance().build(RouteConsts.provider.setting).navigation() as? ISettingProvider
    }

    fun getSettingIntent(context: Context, isUpdate: Boolean, entrance: String): Intent {
        return mSettingProvider?.getSettingIntent(context, isUpdate, entrance) ?: Intent(
            context,
            MainActivity::class.java
        )
    }

    fun getSecurityIntent(context: Context, entrance: String, isLogoutStyle: Boolean = false): Intent {
        return mSettingProvider?.getSecurityIntent(context, entrance, isLogoutStyle) ?: Intent(
            context,
            MainActivity::class.java
        )
    }

    fun getAboutIntent(context: Context?, isUpdate: Boolean): Intent {
        return mSettingProvider?.getAboutIntent(context, isUpdate) ?: Intent(context, MainActivity::class.java)
    }

    fun getBindPhoneNormalIntent(context: Context, isChangePhone: Boolean): Intent {
        return mSettingProvider?.getBindPhoneNormalIntent(context, isChangePhone) ?: Intent(
            context,
            MainActivity::class.java
        )
    }
}