package com.adealink.weparty.commonui

import android.graphics.Typeface
import androidx.core.graphics.toColorInt
import com.adealink.frame.aab.util.getCompatFont
import com.adealink.weparty.commonui.drawabletoolbox.GradientBorderBuilder
import com.adealink.weparty.commonui.drawabletoolbox.GradientBorderDrawable
import com.adealink.weparty.commonui.ext.dpf
import com.adealink.weparty.R as APP_R

const val MIN_YEAR = 1970
const val SINGLE_CHOICE = 0
const val MULTIPLE_CHOICE = 1
const val SINGLE_MUST_CHOICE = 2

val DEFAULT_FONT_REGULAR: Typeface
    get() {
        return getCompatFont(APP_R.font.poppins_regular)?.let { font ->
            Typeface.create(font, Typeface.NORMAL)
        } ?: Typeface.defaultFromStyle(Typeface.NORMAL)
    }
val DEFAULT_FONT_BOLD: Typeface
    get() {
        return getCompatFont(APP_R.font.poppins_semibold)?.let { font ->
            Typeface.create(font, Typeface.BOLD)
        } ?: Typeface.defaultFromStyle(Typeface.BOLD)
    }


fun commonSelectedDrawable(
    radii: Float = 12.dpf(),
    borderWidth: Float = 1.dpf(),
    solidColor: Int? = null
): GradientBorderDrawable {
    return GradientBorderBuilder().apply {
        setRadii(
            floatArrayOf(
                radii,
                radii,
                radii,
                radii,
                radii,
                radii,
                radii,
                radii
            )
        )
        setBorderWidth(borderWidth)
        setBorderAngle(315)
        setBorderColors(intArrayOf("#4ED2FF".toColorInt(), "#B1EF5D".toColorInt()))
        solidColor?.let {
            setBgColor(solidColor)
        }
    }.build()
}