package com.lukouguoji.aerologic.page.coldStorage.list

import android.view.View
import com.lukouguoji.aerologic.databinding.ItemColdStorageBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.ColdStorageBean

/**
 * 冷库登记 列表项ViewHolder
 */
class ColdStorageViewHolder(view: View) :
    BaseViewHolder<ColdStorageBean, ItemColdStorageBinding>(view) {

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

        // 添加图标点击事件 - 切换选择状态
        binding.ivIcon.setOnClickListener {
            bean.checked.set(!bean.checked.get())
            binding.executePendingBindings()
        }
    }
}
