package com.zj365.health.adapter

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.zj365.health.R

class RiskAssessAdapter : BaseAdapter<String>(R.layout.item_risk_assess) {
    val col by lazy {
        mapOf(
            "零风险" to R.drawable.shape_low_round,
            "低风险" to R.drawable.shape_low_round,
            "中风险" to R.drawable.shape_middle_round,
            "高风险" to R.drawable.shape_high_round,
            "很高风险" to R.drawable.shape_super_high_round,
        )
    }

    private val textCol by lazy {
        mapOf(
            "零风险" to R.color.col_9Bd,
            "低风险" to R.color.col_9Bd,
            "中风险" to R.color.col_96D,
            "高风险" to R.color.col_481,
            "很高风险" to R.color.col_2621,
        )
    }

    val mipmaps by lazy {
        arrayOf(
            R.mipmap.ic_quest_1,
            R.mipmap.ic_quest_4,
            R.mipmap.ic_quest_2,
            R.mipmap.ic_quest_3

        )
    }
    val title by lazy {
        arrayOf(
            "高血压风险评估报告",
            "糖尿病风险评估报告",
            "冠心病风险评估报告",
            "脑卒中风险评估报告"

        )
    }

    override fun convert(holder: BaseViewHolder, item: String) {


        holder.setText(R.id.mTitle, title[holder.layoutPosition])
        holder.setText(R.id.mStatus, item)
        holder.setBackgroundResource(R.id.mStatus, col[item]!!)
        holder.setTextColor(R.id.mStatus,ContextCompat.getColor(context, textCol[item]!!))
        holder.setImageResource(R.id.mImage, mipmaps[holder.layoutPosition])
    }
}