package com.hongyegroup.cpt_parttime.adapter

import com.chad.library.adapter.base.BaseNodeAdapter
import com.chad.library.adapter.base.entity.node.BaseNode
import com.hongyegroup.cpt_parttime.bean.PartDetailAnswer
import com.hongyegroup.cpt_parttime.bean.PartDetailQuestion

/**
 * FQA的展开收起Adapter
 */
class PartDetailQAAdapter : BaseNodeAdapter() {

    init {
        //添加Node适配器
        addNodeProvider(QuestionNodeProvider())
        addNodeProvider(AnswerNodeProvider())
    }

    override fun getItemType(data: List<BaseNode>, position: Int): Int {
        return when (data[position]) {
            is PartDetailQuestion -> 0
            is PartDetailAnswer -> 1
            else -> -1
        }
    }

}