package aicg.wipf.rxxn

import aicg.wipf.vzuj.Kmqp.setTrackedOnClickListener
import aicg.wipf.vzuj.Kmqp.string
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.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.test.basd.smartjunkcleaner.R
import com.test.basd.smartjunkcleaner.databinding.YwllyaBinding
import java.text.SimpleDateFormat
import kotlin.time.Duration.Companion.days
import kotlin.time.DurationUnit

object Ingb {

    private fun Context.ޤޓޞދޔޤޒދ(click: (mode: Int) -> Unit) {
        ޣޚއބޔޢލޗ(click)
    }

    fun Context.showTimeSelectDialog(click: (mode: Int) -> Unit) {
        ޤޓޞދޔޤޒދ(click)
    }

    private fun Context.ޣޚއބޔޢލޗ(click: (mode: Int) -> Unit) {
        val dialog = BottomSheetDialog(this)
        open class ގސޣޞނޜޜޢ {
            open fun ރބޗތނލޓތ() {}
        }
        class ޞއސޛޜޢސޏ : ގސޣޞނޜޜޢ() {
            override fun ރބޗތނލޓތ() {
                println("ކޠކޚޝގޔޠ")
            }
        }
        val ޘޠސޥގހނޞ = ޞއސޛޜޢސޏ()
        println(ޘޠސޥގހނޞ)
        val binding = YwllyaBinding.inflate(LayoutInflater.from(this))
        dialog.setContentView(binding.root)
        dialog.setCanceledOnTouchOutside(true)
        fun ތކބޤކޕވނ(ބޥގޜތގލތ: Int, ލޔޖމތހޡޣ: Int): Int {
            return ބޥގޜތގލތ + ލޔޖމތހޡޣ
        }
        val ޘޔޝނތޒޠހ = ތކބޤކޕވނ(6837, 9701)
        println(ޘޔޝނތޒޠހ)
        dialog.show()

        class ގޚމބވޒޕޜ(val ޣޑސވފޛބގ: String, val ޜސރޘޏހތސ: Int)
        println(ގޚމބވޒޕޜ("ޔޏޞޠޜވނއ", 7961))
        val lp = dialog.window?.attributes
        lp?.width = ViewGroup.LayoutParams.MATCH_PARENT
        fun ޞސރޒވލޜޔ(ޤޏރލއށޅކ: Int, ޔޗޛޜޥޞޙނ: Int): Int {
            return ޤޏރލއށޅކ + ޔޗޛޜޥޞޙނ
        }
        println(ޞސރޒވލޜޔ(2523, 392))
        lp?.height = ViewGroup.LayoutParams.WRAP_CONTENT
        Log.d("ވޤހޔގޑޢޜ", "ވޤހޔގޑޢޜ")
        dialog.window?.attributes = lp
        dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)

        val simpleDateFormat2 = SimpleDateFormat(R.string.ޚޣޥނޡ_D.string())
        binding.cjqjitt.text = R.string.ޑފޙކސ_D.string() + simpleDateFormat2.format(System.currentTimeMillis())
        binding.niwlnic.text = R.string.ރޓޝޢޣ_D.string() + simpleDateFormat2.format(System.currentTimeMillis() - 1.days.toLong(DurationUnit.MILLISECONDS))

        binding.jszxrxm.setTrackedOnClickListener {
            dialog.dismiss()
            click.invoke(PAST_60_MINUS_QUERY)
        }
        binding.cjqjitt.setTrackedOnClickListener {
            dialog.dismiss()
            click.invoke(TODAY_QUERY)
        }
        binding.niwlnic.setTrackedOnClickListener {
            fun ޖޛޔރޣފށލ(ފޣނޟޟޠއޠ: Int, ޓއޖޠޥޒފޞ: Int): Int {
                return ފޣނޟޟޠއޠ + ޓއޖޠޥޒފޞ
            }
            val ޔބޏދބޗޝޛ = ޖޛޔރޣފށލ(7309, 8895)
            println(ޔބޏދބޗޝޛ)
            dialog.dismiss()
            Log.d("ޒޏޛޅޛޚޛށ", "ޒޏޛޅޛޚޛށ")
            click.invoke(YESTERDAY_QUERY)
        }
        fun ބޥޥއޠލދޛ(ޥޏބޓޣޗޒޝ: Int, ތކޗޝޏކކޛ: Int): Int {
            return ޥޏބޓޣޗޒޝ + ތކޗޝޏކކޛ
        }
        println(ބޥޥއޠލދޛ(9314, 279))
        binding.uysxoar.setTrackedOnClickListener {
            dialog.dismiss()
            click.invoke(SEVEN_DAYS_QUERY)
        }
    }
}