package com.lukouguoji.gjj.holder

import android.view.View
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ItemIntArrAirManifestBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjjAirManifest

/**
 * 国际进港原始舱单 ViewHolder
 */
class IntArrAirManifestViewHolder(view: View) :
    BaseViewHolder<GjjAirManifest, ItemIntArrAirManifestBinding>(view) {

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

        binding.bean = bean
        binding.manifest = manifest
        binding.position = position
        binding.executePendingBindings()

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