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

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
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.ui.theme.shapes.ArrowShape

@Composable
fun ArrowShape(
    modifier: Modifier = Modifier,
    size: Dp = 24.dp,
    core: Dp = 4.dp,
    head: Dp = 4.dp,
    thickness: Dp = 1.dp,
    paddingValues: PaddingValues = PaddingValues(horizontal = 2.dp, vertical = 3.dp),
    color: Color = MaterialTheme.lwa.colorScheme.base.primary,
) {
    val arrow = remember(core, head) {
        ArrowShape(core = core, head = head)
    }
    Box(
        modifier = Modifier
            .size(size = size)
            .padding(
                paddingValues = paddingValues,
            )
            .border(
                width = thickness,
                color = color,
                shape = arrow,
            )
            .shadow(
                elevation = 2.dp,
                shape = arrow,
                ambientColor = MaterialTheme.lwa.colorScheme.portrait.levelUp,
                spotColor = MaterialTheme.lwa.colorScheme.portrait.levelUp,
            )
            .shadow(
                elevation = 1.dp,
                shape = arrow,
            )
            .then(
                other = modifier,
            )
    )
}