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.color.col_41c_14,
            "低风险" to R.color.col_dbf,
            "中风险" to R.color.col_8db,
            "高风险" to R.color.col_0db,
            "很高风险" to R.color.col_1db,
        )
    }
    val mipmaps by lazy {
        arrayOf(
            R.mipmap.ic_quest_1,
            R.mipmap.ic_quest_2,
            R.mipmap.ic_quest_3,
            R.mipmap.ic_quest_4
        )
    }
    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.setBackgroundColor(R.id.mStatus, ContextCompat.getColor(context, col[item]!!))
        holder.setImageResource(R.id.mImage, mipmaps[holder.layoutPosition])
    }
}