package com.adealink.weparty.commonui.drawabletoolbox

import com.adealink.weparty.commonui.ext.dpf

class FluidColorfulFrameDrawableBuilder : DrawableWrapperBuilder<FluidColorfulFrameDrawableBuilder>() {

    private var radius: Float = 10.dpf()
    private var strokeWidth: Float = 5.dpf()
    private var colors: IntArray = intArrayOf()
    private var positions: FloatArray = floatArrayOf()
    private var duration: Long = 0L
    private var fromDegree: Float = 0f

    fun radius(radius: Float) = apply { this.radius = radius }
    fun strokeWidth(strokeWidth: Float) = apply { this.strokeWidth = strokeWidth }
    fun colors(colors: IntArray) = apply { this.colors = colors }
    fun positions(positions: FloatArray) = apply { this.positions = positions }
    fun duration(duration: Long) = apply { this.duration = duration }
    fun fromDegree(degree: Float) = apply { this.fromDegree = degree }

    override fun build(): FluidColorfulFrameDrawable {
        return FluidColorfulFrameDrawable().apply {
            setRadius(radius)
            setStrokeWidth(strokeWidth)
            setColorsAndPosition(colors, positions)
            setDuration(duration)
            degree = fromDegree
        }
    }
}