package com.lukouguoji.gjj.holder

import android.view.View
import com.lukouguoji.gjj.databinding.ItemIntImpManifestSubBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjjHaWb

/**
 * 国际进港舱单 - 分单子列表 ViewHolder
 */
class IntImpManifestSubViewHolder(view: View) :
    BaseViewHolder<GjjHaWb, ItemIntImpManifestSubBinding>(view) {

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

        // 单选框点击切换选择状态
        binding.ivCheckbox.setOnClickListener {
            val newCheckedState = !bean.checked.get()
            bean.checked.set(newCheckedState)
            binding.executePendingBindings()
        }
    }
}
