package com.module.backstage.vm

import androidx.lifecycle.MutableLiveData
import com.module.backstage.databinding.BackstageFragmentLanguageBinding
import com.module.backstage.repo.LanguageFragmentRepo
import com.quyunshuo.androidbaseframemvvm.base.mvvm.vm.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 * HomeFragment 的 VM 层
 *
 * @author Qu Yunshuo
 * @since 2021/8/5 11:11 下午
 */
@HiltViewModel//@HiltViewModel 注解的作用是将 ViewModel 标记为可以由 Hilt 管理的依赖项。当你将 @HiltViewModel 注解添加到 ViewModel 类上时，Hilt 会自动处理 ViewModel 的创建和注入过程。这样，你就不需要手动调用 ViewModelProvider 来获取 ViewModel 实例了。
class LanguageFragmentVM @Inject constructor(private val mRepo: LanguageFragmentRepo) :
    BaseViewModel() {

    /**
     * 当前已获取的文章页码
     */
    private var mCurrArticlePage = 1


    /**
     * 文章列表数据加载 first:是否是加载更多、second:加载更多是否成功
     */
    val articleLoadLD = MutableLiveData<Pair<Boolean, Boolean>>()

    /**
     * 是否已经加载了全部
     */
    val isLoadAllLD = MutableLiveData<Boolean>()

    /**
     * 获取 banner 数据
     */
    fun getBanners() {

    }

    /**
     * 获取文章数据
     */
    fun getArticleData() {

    }

    fun setSelectLanguage(mBinding: BackstageFragmentLanguageBinding, languageType: Int) {
        when (languageType) {
            0 -> {
                mBinding.flLanguage.check(mBinding.rbChinese.id)
            }

            1 -> {
                mBinding.flLanguage.check(mBinding.rbEnglish.id)
            }

            2 -> {
                mBinding.flLanguage.check(mBinding.rbGerman.id)
            }

            3 -> {
                mBinding.flLanguage.check(mBinding.rbRussia.id)
            }

            4 -> {
                mBinding.flLanguage.check(mBinding.rbJapanese.id)
            }

            5 -> {
                mBinding.flLanguage.check(mBinding.rbSpanish.id)
            }

            6 -> {
                mBinding.flLanguage.check(mBinding.rbFrench.id)
            }

            7 -> {
                mBinding.flLanguage.check(mBinding.rbBulgaria.id)
            }

            8 -> {
                mBinding.flLanguage.check(mBinding.rbDanmai.id)
            }

            9 -> {
                mBinding.flLanguage.check(mBinding.rbFenlan.id)
            }

            10 -> {
                mBinding.flLanguage.check(mBinding.rbHelan.id)
            }

            11 -> {
                mBinding.flLanguage.check(mBinding.rbJieke.id)
            }

            12 -> {
                mBinding.flLanguage.check(mBinding.rbLuomaniya.id)
            }

            13 -> {
                mBinding.flLanguage.check(mBinding.rbNuowei.id)
            }

            14 -> {
                mBinding.flLanguage.check(mBinding.rbPutaoya.id)
            }

            15 -> {
                mBinding.flLanguage.check(mBinding.rbRuishi.id)
            }

            16 -> {
                mBinding.flLanguage.check(mBinding.rbSifaluoke.id)
            }

            17 -> {
                mBinding.flLanguage.check(mBinding.rbXiongyali.id)
            }

            18 -> {
                mBinding.flLanguage.check(mBinding.rbYidali.id)
            }

            19 -> {
                mBinding.flLanguage.check(mBinding.rbTaiwang.id)
            }

            20 -> {
                mBinding.flLanguage.check(mBinding.rbHany.id)
            }

            21 -> {
                mBinding.flLanguage.check(mBinding.rbBolan.id)
            }

            22 -> {
                mBinding.flLanguage.check(mBinding.rbWukelan.id)
            }

            23 -> {
                mBinding.flLanguage.check(mBinding.rbYsl.id)
            }

            24 -> {
                mBinding.flLanguage.check(mBinding.rbAlb.id)
            }

            25 -> {
                mBinding.flLanguage.check(mBinding.rbTg.id)
            }

            26 -> {
                mBinding.flLanguage.check(mBinding.rbYsl.id)
            }

            27 -> {
                mBinding.flLanguage.check(mBinding.rbBrazil2.id)
            }

            28 -> {
                mBinding.flLanguage.check(mBinding.rbGljy.id)
            }

            29 -> {
                mBinding.flLanguage.check(mBinding.rbBrazil3.id)
            }

            30 -> {
                mBinding.flLanguage.check(mBinding.rbTurkey.id)
            }

            31 -> {
                mBinding.flLanguage.check(mBinding.rbLatvia.id)
            }

            32 -> {
                mBinding.flLanguage.check(mBinding.rbPortugalRa.id)
            }

            33 -> {
                mBinding.flLanguage.check(mBinding.rbEesti.id)
            }

            34 -> {
                mBinding.flLanguage.check(mBinding.rbMgy.id)
            }

            35 -> {
                mBinding.flLanguage.check(mBinding.rbBsny.id)
            }

            36 -> {
                mBinding.flLanguage.check(mBinding.rbSlwny.id)
            }

            37 -> {
                mBinding.flLanguage.check(mBinding.rbKldy.id)
            }

            38 -> {
                mBinding.flLanguage.check(mBinding.rbBsny.id)
            }

            else -> {
                mBinding.flLanguage.check(mBinding.rbChinese.id)
            }
        }

    }
}