package importantedto.candidateedto

import android.annotation.SuppressLint
import android.content.Intent
import com.base.datarecovery.R
import com.base.datarecovery.databinding.MinisteredtoBinding
import importantedto.admireedto.sweptedto.Differenceedto
import importantedto.afteredto.constitutionaledto.Jumpedto
import importantedto.appliededto.surgeonedto.promiseedto.Byedto
import importantedto.appliededto.surgeonedto.promiseedto.forthedto.Appearanceedto
import importantedto.concreteedto.cameedto.Hateedto.isGuide
import importantedto.gallonedto.Waitedto

class Correctedto constructor() : Jumpedto<MinisteredtoBinding>() {

    var page: Int = 1

    override val binding: MinisteredtoBinding by lazy {
        MinisteredtoBinding.inflate(layoutInflater)
    }


    @SuppressLint("SetTextI18n")
    override fun setView() {
        if (page == 1) {
            binding.deficitedto.setImageResource(R.mipmap.champagneedto)
            binding.bubbleedto.text = "All Free"
            binding.trolleyedto.text = "Next"
//            binding.poltroonedto.visibility = View.VISIBLE
        } else {
            binding.deficitedto.setImageResource(R.mipmap.justiceedto)
            binding.bubbleedto.text = "Effective recovery"
            binding.trolleyedto.text = "Start"
//            binding.poltroonedto.visibility = View.GONE
        }
    }

    override fun setListener() {
        super.setListener()
        binding.trolleyedto.setOnClickListener {
            if (page == 1) {
                (requireActivity() as Appearanceedto).setPosition(1)
            } else {
                jumpMain()
            }
        }
        binding.poltroonedto.setOnClickListener {
            jumpMain()
        }
    }

    private fun jumpMain() {
        val showAd = Waitedto.getInstance().getString("isShowGuideAd", "0")?.toInt()
        if (showAd == 1) {
            Differenceedto.admobMaxShowInterstitialAd(requireActivity(),false) {
                startActivity(Intent(requireContext(), Byedto::class.java))
                requireActivity().finish()
                isGuide = true
            }
        } else {
            startActivity(Intent(requireContext(), Byedto::class.java))
            requireActivity().finish()
            isGuide = true
        }
    }
}