package com.adealink.weparty.module.widget.form.field.multiplechoice

import android.content.Context
import android.view.ViewGroup
import androidx.lifecycle.LifecycleOwner
import com.adealink.weparty.module.widget.form.adapter.WidgetDelegate

class MultipleChoiceDelegate :
    WidgetDelegate<MultipleChoiceWidgetData, MultipleChooseWidgetView>() {
    override fun onCreateView(
        lifecycleOwner: LifecycleOwner,
        context: Context,
        parent: ViewGroup,
        data: MultipleChoiceWidgetData
    ): MultipleChooseWidgetView {
        val widget = MultipleChooseWidgetView(context)
        parent.addView(
            widget, ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT
            )
        )
        widget.onViewCreated(lifecycleOwner, data)
        return widget
    }
}