package com.adealink.weparty.room.micseat.decor

import android.content.Context
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.adealink.weparty.room.R
import com.adealink.weparty.room.micseat.DecorDynamicLayers

class MuteDecorView(
    dynamicLayers: DecorDynamicLayers,
) : BaseDecorView<AppCompatImageView>(R.id.id_mic_seat_mute_decor, dynamicLayers),
    IMuteDecorApi {

    override fun createView(context: Context): AppCompatImageView {
        return AppCompatImageView(context)
            .apply {
                setImageResource(R.drawable.room_micseat_seat_mute_ic)
            }
    }

    override fun getLayoutParams(): ConstraintLayout.LayoutParams {
        return ConstraintLayout.LayoutParams(
            (baseSize * MUTE_RATIO).toInt(),
            (baseSize * MUTE_RATIO).toInt()
        ).apply {
            endToEnd = R.id.id_mic_seat_avatar_decor
            bottomToBottom = R.id.id_mic_seat_avatar_decor
        }
    }

    override fun showMute(mute: Boolean) {
        if (mute) {
            show()
            view {
                it.setImageResource(R.drawable.room_micseat_seat_mute_ic)
            }
        } else {
            gone()
        }
    }

}