package com.gh.gamecenter.game.columncollection.detail

import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor

/**
 * 游戏专题合集详情页
 */
class ColumnCollectionDetailActivity : ToolBarActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
    }

    override fun provideNormalIntent(): Intent {
        return getTargetIntent(
            this,
            ColumnCollectionDetailActivity::class.java,
            ColumnCollectionDetailFragment::class.java,
            intent.putExtra(EntranceConsts.KEY_LOCATION, "合集详情").extras
        )
    }

    override fun isAutoResetViewBackgroundEnabled(): Boolean = true

    override fun onDarkModeChanged() {
        super.onDarkModeChanged()
        updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
    }

    override fun getBusinessId(): Pair<String, String> {
        val fragment = targetFragment as? ColumnCollectionDetailFragment?
        return if (fragment?.arguments != null) {
            Pair(fragment.requireArguments().getString(EntranceConsts.KEY_COLLECTION_ID) ?: "", "")
        } else {
            super.getBusinessId()
        }
    }

}