package com.yidianling.im.session.viewholder

import android.view.View
import android.widget.TextView
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.yidianling.im.R
import com.yidianling.im.session.extension.CustomAttachmentInquiryReceive
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase

/**
 * 接诊结束 消息  页面
 */
class MsgViewHolderInquiryreceive(adapter: BaseMultiItemFetchLoadAdapter<*, *>?) :
    MsgViewHolderBase(adapter) {

    private var name: TextView? = null
    private var gender_name: TextView? = null
    private var age: TextView? = null
    private var mainSuit: TextView? = null
    private var item: View? = null
    var itemBean: CustomAttachmentInquiryReceive? = null
    override fun getContentResId(): Int {
        return R.layout.im_nim_inquiry_receive_layout
    }

    override fun inflateContentView() {
        name = findViewById(R.id.name)
        gender_name = findViewById(R.id.gender_name)
        age = findViewById(R.id.age)
        mainSuit = findViewById(R.id.mainSuit)
        item = findViewById(R.id.item)
    }

    override fun bindContentView() {
        itemBean = message.attachment as CustomAttachmentInquiryReceive
        name?.text = itemBean!!.keyFromName
        gender_name?.text = itemBean!!.from_genderName
        age?.text = itemBean!!.keyFromAge
        mainSuit?.text = itemBean!!.keyFromMainsuit

        item?.setOnClickListener { view: View? ->
            NewH5Activity.start(
                view!!.context, H5Params(
                    "${HttpConfig.MEDICAL_H5URL}ct/inquiry/order/details?orderId=${itemBean?.keyFromOrderid}&hideNavBar=1",
                    null
                )
            )

        }
        hideItemBg()
    }
}