package aicg.wipf.rjvj

import aicg.wipf.keyu.bzsb.Anxj
import aicg.wipf.ogbw.ezlb.rgmw.Klmj
import aicg.wipf.rxxn.Ingb.showTimeSelectDialog
import aicg.wipf.tzxq.Mmvu
import aicg.wipf.tzxq.Mmvu.Companion.UI_SCREEN_TIME_MODE
import aicg.wipf.vzuj.Kmqp.setTrackedOnClickListener
import aicg.wipf.vzuj.Kmqp.string
import aicg.wipf.vzuj.Olcb
import aicg.wipf.vzuj.Sjdo.PAST_60_MINUS_QUERY
import aicg.wipf.vzuj.Sjdo.SEVEN_DAYS_QUERY
import aicg.wipf.vzuj.Sjdo.TODAY_QUERY
import aicg.wipf.vzuj.Sjdo.YESTERDAY_QUERY
import android.graphics.Typeface
import android.os.Bundle
import android.util.Log
import com.test.basd.smartjunkcleaner.R
import com.test.basd.smartjunkcleaner.databinding.XtfsjmBinding
import java.text.SimpleDateFormat
import kotlin.time.Duration.Companion.hours
import kotlin.time.DurationUnit

class Lrus : Olcb<XtfsjmBinding>() {

    private val dataList = arrayListOf<Klmj>()

    override val binding: XtfsjmBinding by lazy {
        class ޣޒރޏޛބޑމ(val ޜޅގހޗއޝޕ: String, val މޥޗށށނޓޠ: Int)
        println(ޣޒރޏޛބޑމ("ޔޑޑލޝރޢޙ", 4809))
        XtfsjmBinding.inflate(layoutInflater)
    }

    private lateinit var adapter: Mmvu

    private var simpleDateFormat2 = SimpleDateFormat(R.string.ޚޣޥނޡ_D.string())

    private fun ޅޟޢނލޅދރ(savedInstanceState: Bundle?) {
        ލޡޤޙހޣޣވ(savedInstanceState)
    }

    private fun ތޖކމޠޗލޟ(isReFresh: Boolean = true) {
        ޓގޖލހޜޝމ(isReFresh)
    }

    private fun ނޏފޕޙޚބކ(isReFresh: Boolean = true) {
        ތޜނއޓބސށ(isReFresh)
    }

    private fun ޣކނޡޢފޜޒ(savedInstanceState: Bundle?) {
    }

    private fun ފވޗޥވޘލޥ(isReFresh: Boolean = true) {
        ޛޞޕޥއޢގގ(isReFresh)
    }

    private fun ޛޞޕޥއޢގގ(isReFresh: Boolean = true) {
        binding.ivkujwu.text = R.string.ޘޟގލމ_D.string() + simpleDateFormat2.format(System.currentTimeMillis())
        if (isReFresh) {
            val ތޟބތވވސފ = 9480
            val ޙޕޛޑލޞރޑ = 3720
            val ޚއޣފޟތޟޕ = ތޟބތވވސފ * ޙޕޛޑލޞރޑ * ޙޕޛޑލޞރޑ
            println(ޚއޣފޟތޟޕ)
            (requireActivity() as Anxj).changeTimeRefresh(TODAY_QUERY, 1)
        }
    }

    private fun ލޡޤޙހޣޣވ(savedInstanceState: Bundle?) {
        class ވޅޢސޏޣޔޛ<T, K>(val ޞޙޔޓޅޤޓޕ: T, val ޢޖމސޑތނޒ: K) {
            init {
                println("ކޗޣއވޞފތ")
            }
        }
        val މޒވޚޔޘޜގ = ވޅޢސޏޣޔޛ("ލމތޥޕތޑއ", 4103)
        println(މޒވޚޔޘޜގ)
        ޣކނޡޢފޜޒ(savedInstanceState)
    }

    private fun މޝކވތޑފޗ(isReFresh: Boolean = true) {
        ފވޗޥވޘލޥ(isReFresh)
    }

    private fun ދޣލށނޖޤޖ(savedInstanceState: Bundle?) {
        class ރފޛޖޥޝޟޕ<T>(val ލޜޖޓޔބޚޚ: T, val އޕޑށޖޅޥޛ: Int) {
            constructor(ޣށހޠމޝޣދ: T) : this(ޣށހޠމޝޣދ, 916) {
                println("ބޠޘބބގޡދ")
            }
        }
        println(ރފޛޖޥޝޟޕ("ޔފޏޢޕހޞބ"))
        ލފޅޢދތޅޖ(savedInstanceState)
    }

    fun setScreenData(dataList: ArrayList<Klmj>) {
        class ހލގޒޤޕރޕ<T>(val ޥތއވޟފށކ: T)
        val ގޣޜޠޖވޔޞ = ހލގޒޤޕރޕ(6341)
        val ޛޟހސސށފޓ = ހލގޒޤޕރޕ("އޢޢޠޡޛކޅ")
        println(ގޣޜޠޖވޔޞ.ޥތއވޟފށކ)
        println(ޛޟހސސށފޓ.ޥތއވޟފށކ)
        ޘޓރޓޖސޞޓ(dataList)
    }

    fun todayUI(isReFresh: Boolean = true) {
        class ޝރޖޜޕބޤޔ {
            val ޗޕމޢޞތލޞ by lazy {
                println("ޗކހބޏޖސޞ")
                "ސޅޑޗމކޒޢ!"
            }
        }
        val ޗޅކހޑޥޚޗ = ޝރޖޜޕބޤޔ()
        println(ޗޅކހޑޥޚޗ.ޗޕމޢޞތލޞ)
        ޝޟޓދޓޖސހ(isReFresh)
    }

    private fun ލފޅޢދތޅޖ(savedInstanceState: Bundle?) {
        val ޟޒއޥޣގޞގ: (Int, Int) -> Int = { ބޔޒށޕގއތ, ޒޅޝތޡޢޑޞ -> ބޔޒށޕގއތ + ޒޅޝތޡޢޑޞ }
        println(ޟޒއޥޣގޞގ.invoke(7900, 5211))
        ޠޠޘޅހދޛޛ(savedInstanceState)
    }

    override fun setView() {
        ތޞޥދޠޤޝއ()
    }

    private fun setTextFont() {
        ނނޛޚރޟމޗ()
    }

    private fun ޒދޕއސތރނ(savedInstanceState: Bundle?) {
    }

    private fun ޣތޅޛރޜޓޗ(savedInstanceState: Bundle?) {
        ޒދޕއސތރނ(savedInstanceState)
    }

    private fun ތޞޥދޠޤޝއ() {
        abstract class ރޥޏޥހޅލޤ {
            abstract fun ތޝޢޢމހވޔ()
        }
        class ޡލޓޕޛޠޝގ : ރޥޏޥހޅލޤ() {
            override fun ތޝޢޢމހވޔ() {
                println("ޞތޘޟޘގށލ")
            }
        }
        val ޚތށޓފޅހނ = ޡލޓޕޛޠޝގ()
        ޚތށޓފޅހނ.ތޝޢޢމހވޔ()
        setTextFont()
        fun <T> ޛޗޔތޚޤޚޕ(ތޟނށހހޛޓ: T) {
            println(ތޟނށހހޛޓ)
        }
        ޛޗޔތޚޤޚޕ(619)
        ޛޗޔތޚޤޚޕ("ޑޥޣޢޔޏތލ")
        binding.hhuregk.setTrackedOnClickListener {
            val އވވއޤޏޟޕ = { ޒނޅޝޢޝޢޤ: String -> println(ޒނޅޝޢޝޢޤ) }
            އވވއޤޏޟޕ("ޡމކޘޕސޓޝ!")
            requireContext().showTimeSelectDialog {
                class ޜޓހޥލޚޞމ<T>(val ޞޚޣޛޒބހޖ: T, val ތޣސވޞށގމ: Int) {
                    constructor(ކހސލޓތޑވ: T) : this(ކހސލޓތޑވ, 3210) {
                        println("ލޜޟބޕސފޡ")
                    }
                }
                println(ޜޓހޥލޚޞމ("އލލގތޛޅޑ"))
                when (it) {
                    PAST_60_MINUS_QUERY -> {
                        class ވޏޔދޕޠވތ<T>(val ޣރޢޝޝފޑޞ: T, val ތޡޏރޛޣޔށ: Int) {
                            constructor(ޣރޢޝޝފޑޞ: T) : this(ޣރޢޝޝފޑޞ, 5058) {
                                println("ތޡޏރޛޣޔށ")
                            }
                        }
                        println(ވޏޔދޕޠވތ("ޘގޛޟޟޤޠޞ"))
                        recent60UI()
                    }

                    TODAY_QUERY -> {
                        todayUI()
                    }

                    YESTERDAY_QUERY -> {
                        class ލޠޕޥފދޞޞ<T>(val ޕޕޚމލފޏޟ: T, val ޒޑޚކށޠސޤ: Int) {
                            constructor(ޕޕޚމލފޏޟ: T) : this(ޕޕޚމލފޏޟ, 8742) {
                                println("ޒޑޚކށޠސޤ")
                            }
                        }
                        println(ލޠޕޥފދޞޞ("ޕޞޞޜފފދރ"))
                        yesterdayUI()
                    }

                    SEVEN_DAYS_QUERY -> {
                        sevenDaysUI()
                    }
                }
            }
        }
        Log.d("ޗކޔޝޏޣފޘ", "ޗކޔޝޏޣފޘ")
        adapter = Mmvu(requireActivity(), UI_SCREEN_TIME_MODE)
        binding.pvaiyzw.adapter = adapter
        class ޔއޞވސލސށ(val ޥޕޜޓގޏޚރ: String, val ޕބޜޓސއކޙ: Int)
        println(ޔއޞވސލސށ("ޞޢޖޙދގޛފ", 2977))
        adapter.setData(dataList)
        todayUI(false)
    }

    private fun އޓޟބޤޓޚޣ(isReFresh: Boolean = true) {
        ސޗޚސޝޞޞޤ(isReFresh)
    }

    private fun ޡޘކޓރޓޥތ(dataList: ArrayList<Klmj>) {
        this.dataList.clear()
        Log.d("ރވޣޟޝށއޘ", "ރވޣޟޝށއޘ")
        this.dataList.addAll(dataList.filter { it.screenTime > 0 })
        if (isVisible) {
            adapter.setData(this.dataList)
        }
    }

    private fun ޘޓރޓޖސޞޓ(dataList: ArrayList<Klmj>) {
        ޡޘކޓރޓޥތ(dataList)
    }

    private fun ނނޛޚރޟމޗ() {
        val fontMedium = R.string.ގޗބޓވ_D.string()
        val fontMediumTypeface = Typeface.create(fontMedium, Typeface.NORMAL)
        binding.ivkujwu.setTypeface(fontMediumTypeface)
    }

    fun recent60UI(isReFresh: Boolean = true) {
        binding.ivkujwu.text = R.string.ގޢހތޅ_D.string()
        if (isReFresh) {
            (requireActivity() as Anxj).changeTimeRefresh(PAST_60_MINUS_QUERY, 1)
        }
    }

    private fun ޠޜޒޏޥޝޕޙ(isReFresh: Boolean = true) {
        class ޣށޞށޙޢޚބ<T>(val ޕޞދރށޅޤނ: T)
        val ޞސތޙށލފޘ = ޣށޞށޙޢޚބ(9094)
        val ޣޥޜހއޤމޔ = ޣށޞށޙޢޚބ("ޗޙޒޠޡސޕޔ")
        println(ޞސތޙށލފޘ.ޕޞދރށޅޤނ)
        println(ޣޥޜހއޤމޔ.ޕޞދރށޅޤނ)
        އޓޟބޤޓޚޣ(isReFresh)
    }

    private fun ޝޟޓދޓޖސހ(isReFresh: Boolean = true) {
        މޝކވތޑފޗ(isReFresh)
    }

    private fun ތޚޠރބޕޔބ(savedInstanceState: Bundle?) {
        Log.d("ޕނޢޡޛޟޞޓ", "ޕނޢޡޛޟޞޓ")
        ޅޟޢނލޅދރ(savedInstanceState)
    }

    private fun ތޜނއޓބސށ(isReFresh: Boolean = true) {
        ތޖކމޠޗލޟ(isReFresh)
    }

    fun sevenDaysUI(isReFresh: Boolean = true) {
        ނޏފޕޙޚބކ(isReFresh)
    }

    private fun ސޗޚސޝޞޞޤ(isReFresh: Boolean = true) {
        binding.ivkujwu.text = R.string.ހނތބގ_D.string() + simpleDateFormat2.format(
                System.currentTimeMillis() - 24.hours.toLong(
                    DurationUnit.MILLISECONDS
                )
            )
        if (isReFresh) {
            (requireActivity() as Anxj).changeTimeRefresh(YESTERDAY_QUERY, 1)
        }
    }

    fun yesterdayUI(isReFresh: Boolean = true) {
        ޠޜޒޏޥޝޕޙ(isReFresh)
    }

    private fun ފޜމޟހޥގޟ(savedInstanceState: Bundle?) {
        val ޙޏޢފޓބޖޒ: (Int, Int) -> Int = { ޥޟޒޚޤޏދކ, ޛދޜމނޔޟދ -> ޥޟޒޚޤޏދކ + ޛދޜމނޔޟދ }
        println(ޙޏޢފޓބޖޒ.invoke(8806, 1786))
        ތޚޠރބޕޔބ(savedInstanceState)
    }

    private fun ޠޠޘޅހދޛޛ(savedInstanceState: Bundle?) {
        ޣތޅޛރޜޓޗ(savedInstanceState)
    }

    override fun onResume() {
        super.onResume()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        ފޜމޟހޥގޟ(savedInstanceState)
        super.onCreate(savedInstanceState)
        ދޣލށނޖޤޖ(savedInstanceState)
    }

    private fun ޓގޖލހޜޝމ(isReFresh: Boolean = true) {
        fun ރޣޗށޙނޘޢ(ޡސޤތޚޘޓޏ: Int, ބޕޏޤޢޕޠޅ: Int): Int {
            return ޡސޤތޚޘޓޏ + ބޕޏޤޢޕޠޅ
        }
        println(ރޣޗށޙނޘޢ(1656, 7633))
        ބކޖބގޞށޝ(isReFresh)
    }

    private fun ބކޖބގޞށޝ(isReFresh: Boolean = true) {
        binding.ivkujwu.text = R.string.ޠޅކހޥ_D.string()
        if (isReFresh) {
            (requireActivity() as Anxj).changeTimeRefresh(SEVEN_DAYS_QUERY, 1)
        }
    }
}