package com.gamedog.vididin.main.fragments.task

import android.content.Context
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog
import com.gamedog.vididin.databinding.DialogDailySignBinding


class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(context, DialogDailySignBinding::inflate) {
    private lateinit var mDataList: List<DailySignBean>

    fun build(): DailySignDialog {
        with()
        setCenter()
        setMaskValue(0.9f)

        mBinding.run {
            setOnClickBatch(butLeft, butRight) {
                when (this) {
                    butLeft ->  {
                        dismiss()
                    }
                    butRight ->  {
                        handleRightButClicked()
                        dismiss()
                    }
                }
            }

            initDailySignItems()
        }

        show()
        return this
    }



    init {
        mDataList = listOf(
            DailySignBean(1, 100),
            DailySignBean(2, 150),
            DailySignBean(3, 250),
            DailySignBean(4, 300),
            DailySignBean(5, 400),
            DailySignBean(6, 450),
            DailySignBean(7, 700),
        )
    }


    private fun initDailySignItems() {

        with(mBinding) {
            if (mDataList.size >= 7) {
                signItem1.setData(mDataList.get(0))
                signItem2.setData(mDataList.get(1))
                signItem3.setData(mDataList.get(2))
                signItem4.setData(mDataList.get(3))
                signItem5.setData(mDataList.get(4))
                signItem6.setData(mDataList.get(5))
                signItem7.setData(mDataList.get(6))
            }

            signItem7.setLargeWidthMode()
        }

    }

    private fun handleRightButClicked() {

    }

}

