package com.gh.gamecenter.feedback.provider

import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feedback.view.suggest.SuggestionActivity

@Route(path = RouteConsts.provider.linkDirectUtils, name = "DirectUtils暴露服务，主要是暴露directToLinkPage方法")
class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {

    override fun directToLinkPage(
        context: Context,
        linkEntity: LinkEntity,
        entrance: String,
        path: String
    ) {
        ToastUtils.toast("调用->LinkDirectUtilsProviderImpl.directToLinkPage")
    }

    override fun directToLinkPage(
        context: Context,
        linkEntity: LinkEntity,
        entrance: String,
        path: String,
        exposureEvent: ExposureEvent?
    ) {
        ToastUtils.toast("调用->LinkDirectUtilsProviderImpl.directToLinkPage")
    }

    override fun directToSuggestion(context: Context, type: SuggestType, requestCode: Int?) {
        if (requestCode != null) {
            val intent = SuggestionActivity.getIntent(
                context,
                type,
                "",
                "",
                "",
                "",
                null,
                false,
                "",
                false,
                ""
            )
            (context as AppCompatActivity).startActivityForResult(intent, requestCode)
        }
    }

    override fun directToSuggestion(
        context: Context,
        type: SuggestType,
        suggestHintType: String?,
        content: String?,
        isQaFeedback: Boolean,
        qaContentId: String
    ) {
        val intent = SuggestionActivity.getIntent(
            context,
            type,
            "",
            suggestHintType,
            content,
            "",
            null,
            isQaFeedback,
            qaContentId,
            false,
            ""
        )
        context.startActivity(intent)
    }

    override fun directToSuggestion(
        context: Context,
        type: SuggestType,
        suggestHintType: String?,
        content: String?,
        game: SimpleGameEntity,
        platform: String
    ) {
        val intent = SuggestionActivity.getIntent(
            context,
            type,
            "",
            suggestHintType,
            content,
            platform,
            game,
            false,
            "",
            false,
            ""
        )
        context.startActivity(intent)
    }

    override fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String) {
        val intent = SuggestionActivity.getIntent(
            context,
            type,
            hiddenHint,
            "",
            "",
            "",
            null,
            false,
            "",
            false,
            ""
        )
        context.startActivity(intent)
    }


    override fun init(context: Context?) {
        // Do nothing
    }
}