package com.lukouguoji.gjc.holder

import android.view.View
import com.lukouguoji.gjc.databinding.ItemIntExpArriveSubBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjcHaWb

/**
 * 国际出港-出港理货 子订单(分单) ViewHolder
 */
class IntExpArriveSubViewHolder(view: View) :
    BaseViewHolder<GjcHaWb, ItemIntExpArriveSubBinding>(view) {

    override fun onBind(item: Any?, position: Int) {
        val bean = getItemBean(item) ?: return
        binding.bean = bean
        binding.position = position + 1  // 序号从 1 开始
        binding.executePendingBindings()

        // checkbox点击切换选择状态
        binding.ivCheckbox.setOnClickListener {
            bean.checked.set(!bean.checked.get())
            binding.executePendingBindings()
        }
    }
}
