package com.zj365.health.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setImage
import com.zj365.health.R
import com.xty.network.model.CancerImageBean


class PictureDetailShowAdapter : BaseAdapter<CancerImageBean>(R.layout.item_picture_show_detail) {
    var status1: Int? = 0
    override fun convert(holder: BaseViewHolder, item: CancerImageBean) {
        val imageUrl = item.imageUrl
        imageUrl?.let {
            if (it.isEmpty()) {
                holder.itemView.findViewById<ImageView>(R.id.ivImage)
                    .setImageResource(R.mipmap.changctup)
                holder.setGone(R.id.ivDelete, true)
                holder.setVisible(R.id.tvApprovalFail, false)
            } else {
                val status = item.status
                if (status == 2) {
                    //识别失败
                    holder.setVisible(R.id.tvApprovalFail, true)
                } else {
                    holder.setVisible(R.id.tvApprovalFail, false)
                }

                holder.setGone(R.id.ivDelete, false)
                holder.getView<ImageView>(R.id.ivImage)
                    .apply {
                        setImage(context, it)
                    }
                holder.setGone(R.id.ivDelete, status1 == 5 || status1 == 3)
            }
        }
    }
}