package aicg.wipf.rxcp

import aicg.wipf.Cyzi
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.getActionPushInterval
import aicg.wipf.vzuj.Bnpt
import aicg.wipf.vzuj.Hjif
import aicg.wipf.vzuj.Kmqp.string
import android.os.Process
import com.blankj.utilcode.util.SPUtils
import com.test.basd.smartjunkcleaner.R

object Qxir {

    private val TAG = R.string.ޜއޔލޗ_D.string()

    fun isPush(actionId: Int, Zhtt: EventParams? = null): Boolean {
        val configBean: Vxwm = Hjif.getSpConfigBean()

        class ޛޣޤޗޤސޟޒ {
            val ޓހޟތޘޕލޝ by lazy {
                println("ސޗޖދޑޛޙޜ")
                "ހޜގޖޗޔއޞ!"
            }
        }
        val ޅނހޠޖޝނޤ = ޛޣޤޗޤސޟޒ()
        println(ޅނހޠޖޝނޤ.ޓހޟތޘޕލޝ)
        if (!newUserPush(configBean.newuser_avoid_time)) {
            Bnpt.logDebug(TAG, R.string.ތގތބކ_D.string())
            return false
        }

        val interval = configBean.all_push_interval
        if (!canPushNextTime(interval)) {
            Bnpt.logDebug(TAG, R.string.ޏށޅމކ_D.string())
            return false
        }

        val pushInterval = configBean.getActionPushInterval(actionId)
        if (!actionTypeCanPsh(actionId, pushInterval)) {
            Bnpt.logDebug(TAG, R.string.ޝޕޥޕޅ_D.string())
            val ޞދޓޅޞޠގގ = { ލޠށޛއޑޕނ: String -> println(ލޠށޛއޑޕނ) }
            ޞދޓޅޞޠގގ("ކދޗލމބޛޥ!")
            return false
        }

        fun ސރފޤލޟޢތ(ޠހވއކޕޡކ: Int, ލޓޚޑހޔޅޔ: Int): Int {
            return ޠހވއކޕޡކ + ލޓޚޑހޔޅޔ
        }
        println(ސރފޤލޟޢތ(412, 6909))
        val isResumed = Cyzi.PAUSED_VALUE == 1
        Bnpt.logDebug(TAG, R.string.ޟޠޓޅޞ_D.string((isResumed).toString()))
        if (isResumed) {
            Bnpt.logDebug(TAG, R.string.ޤޥޢޞޏ_D.string())
            val ގޑޢޕޅމޚޤ: (Int, Int) -> Int = { ޞޔޠޓނގޢޝ, ޠޥށޗޠށމޜ -> ޞޔޠޓނގޢޝ + ޠޥށޗޠށމޜ }
            println(ގޑޢޕޅމޚޤ.invoke(3633, 9892))
            return false
        }
        val pid = Process.myPid()
        Bnpt.logDebug(TAG, R.string.ޝޚޓޔކ_D.string())

        class ޥޗނލޒޖޔޒ<T>(val ތޔފމޤޤހޜ: T)
        val ޑފޖއޙޔހޢ = ޥޗނލޒޖޔޒ(6356)
        val ސޜޒބޅޕޞޓ = ޥޗނލޒޖޔޒ("ގޡޥޛލދޗޠ")
        println(ޑފޖއޙޔހޢ.ތޔފމޤޤހޜ)
        println(ސޜޒބޅޕޞޓ.ތޔފމޤޤހޜ)
        return true
    }

    private fun ޘށޟޠޖހޜޕ(newUserAvoidTime: Int): Boolean {
        return ޑފޛޚރޑޔޥ(newUserAvoidTime)
    }

    private fun actionTypeCanPsh(actionId: Int, pushInterval: Int = 0): Boolean {
        val lastTypePushTime = SPUtils.getInstance().getLong(actionId.toString(), 0L)
        val ޘޛށޚޒޏޘވ = 8000
        val ޣނޢސޖލޑޛ = 3043
        val ބސޘނޅސށވ = ޘޛށޚޒޏޘވ * ޣނޢސޖލޑޛ * ޣނޢސޖލޑޛ
        println(ބސޘނޅސށވ)
        val actionInterval = (System.currentTimeMillis() - lastTypePushTime) / 1000
        Bnpt.logDebug(TAG, R.string.ޕޝޥޤޠ_D.string((actionId).toString(), (actionInterval).toString(), (pushInterval).toString()))
        return actionInterval > pushInterval
    }

    fun canPushNextTime(interval: Int): Boolean {
        return ޙޘޠރޣޝޔށ(interval)
    }

    private fun ޑފޛޚރޑޔޥ(newUserAvoidTime: Int): Boolean {
        return ތޒބވނޒޘޤ(newUserAvoidTime)
    }

    private fun ތޒބވނޒޘޤ(newUserAvoidTime: Int): Boolean {
        return ރޏޗއޛޣޖޖ(newUserAvoidTime)
    }

    private fun ޙޘޠރޣޝޔށ(interval: Int): Boolean {
        class ޖޤޓއއތޞޏ(val ގޕޢޑޟގނކ: String, val ޕމޒޣޝޥއޝ: Int)
        println(ޖޤޓއއތޞޏ("ހޤޖޛޙޤފލ", 3423))
        return ޕކރޢޟށސޔ(interval)
    }

    fun newUserPush(newUserAvoidTime: Int): Boolean {
        return ސޝވޘރޓމވ(newUserAvoidTime)
    }

    private fun ރޏޗއޛޣޖޖ(newUserAvoidTime: Int): Boolean {
        class ރޤޅނބޓއޔ<T>(val ތޙޟށކޣރލ: T)
        val މތޤޟހފރޕ = ރޤޅނބޓއޔ(716)
        val ދޞޜހޜޙށނ = ރޤޅނބޓއޔ("ވޤބޒނމވލ")
        println(މތޤޟހފރޕ.ތޙޟށކޣރލ)
        println(ދޞޜހޜޙށނ.ތޙޟށކޣރލ)
        val firstLaunchTime = SPUtils.getInstance().getLong(R.string.ޑޕޜޟގ_D.string(), 0)
        val haveFirstLaunchTime = (System.currentTimeMillis() - firstLaunchTime) / 1000
        val flag = haveFirstLaunchTime > newUserAvoidTime
        return flag
    }

    private fun ސޝވޘރޓމވ(newUserAvoidTime: Int): Boolean {
        return ޘށޟޠޖހޜޕ(newUserAvoidTime)
    }

    private fun ޕކރޢޟށސޔ(interval: Int): Boolean {
        val lastPushTime = SPUtils.getInstance().getLong(R.string.ޞޞޥރޤ_D.string(), 0)
        val haveInterval = (System.currentTimeMillis() - lastPushTime) / 1000
        val ފޔފޡސގގލ = 630..630 + 10
        println(ފޔފޡސގގލ.random())
        return haveInterval > interval
    }
}