package com.lukouguoji.gnc.page.assemble.list

import android.view.View
import com.lukouguoji.gnc.R
import com.lukouguoji.gnc.databinding.ItemGncAssembleListBinding
import com.lukouguoji.module_base.adapter.setCommonAdapter
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GncAssembleListBean
import com.lukouguoji.module_base.ktx.refresh

class GncAssembleListViewHolder(view: View) :
    BaseViewHolder<GncAssembleListBean, ItemGncAssembleListBinding>(view) {

    override fun onBind(item: Any?, position: Int) {
        val bean = getItemBean(item)!!
        binding.bean = bean

        notifyItemClick(position, binding.tvDelete)
        notifyItemClick(position, binding.tvModify)

        binding.ivIcon.setOnClickListener {
            bean.checked.set(!bean.checked.get())
        }
        binding.ivShow.setOnClickListener {
            bean.showMore.set(!bean.showMore.get())
        }

        setCommonAdapter(
            binding.rv,
            GncAssembleListMoreViewHolder::class.java,
            R.layout.item_gnc_assemble_item_more
        )
        binding.rv.refresh(bean.warehouseList)
    }

}