package com.adealink.weparty.room.chatroom.page.dispatchcenter

import android.content.Context
import android.view.View
import androidx.annotation.IdRes
import androidx.constraintlayout.widget.ConstraintLayout
import com.adealink.weparty.commonui.layout.DynamicLayerLayoutParamsNotDefineError
import com.adealink.weparty.commonui.layout.DynamicLayerViewNotDefineError
import com.adealink.weparty.commonui.layout.IDynamicViewFactory

/**
 * 语聊房-基础控件层级
 */
class DispatchCenterBaseLayerFactory : IDynamicViewFactory<ConstraintLayout.LayoutParams> {
    @Suppress("UNCHECKED_CAST")
    override fun <V : View> createView(id: Int, context: Context): V {
        return when (id) {
//            R.id.id_chat_room_danmaku_view -> {
//                DanmakuView(context) as V
//            }

            else -> {
                throw DynamicLayerViewNotDefineError(context.resources.getResourceName(id))
            }
        }
    }

    override fun getViewLayoutParam(@IdRes id: Int, context: Context): ConstraintLayout.LayoutParams {
        return when (id) {
//            R.id.id_chat_room_danmaku_view -> {
//                ConstraintLayout.LayoutParams(0, 250.dp()).apply {
//                    topMargin = 90.dp()
//
//                    topToTop = R.id.mic_seat_fragment
//                    startToStart = ConstraintLayout.LayoutParams.PARENT_ID
//                    endToEnd = ConstraintLayout.LayoutParams.PARENT_ID
//                }
//            }

            else -> {
                throw DynamicLayerLayoutParamsNotDefineError(context.resources.getResourceName(id))
            }
        }
    }
}
