package com.pixelized.desktop.lwa.ui.composable.shapes

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.pixelized.desktop.lwa.ui.theme.lwa
import com.pixelized.desktop.lwa.utils.extention.dashedBorder

@Composable
fun MasteryShape(
    modifier: Modifier = Modifier,
    shape: Shape = CircleShape,
    color: Color = MaterialTheme.lwa.colorScheme.base.onSurface,
    borderWidth: Dp = 1.dp,
    size: Dp = 12.dp,
    multiplier: Int,
) {
    when (multiplier) {
        0 -> Box(
            modifier = modifier
                .size(size = size)
                .dashedBorder(
                    width = borderWidth,
                    color = color,
                    shape = shape,
                    on = 3.dp,
                    off = 2.dp
                )
        )

        1 -> Box(
            modifier = modifier
                .size(size = size)
                .background(
                    color = color,
                    shape = shape,
                )
        )

        else -> Box(
            modifier = modifier
                .size(size = size)
                .border(
                    width = borderWidth,
                    color = color,
                    shape = shape
                )
                .padding(all = 2.dp)
        ) {
            MasteryShape(
                shape = shape,
                color = color,
                borderWidth = borderWidth,
                size = size - borderWidth * 3,
                multiplier = multiplier - 1,
            )
        }
    }
}