package cl.homelogic.platform.designsystem.components.atoms

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import cl.homelogic.platform.designsystem.extensions.conditionalClickable
import cl.homelogic.platform.designsystem.foundations.Shapes
import cl.homelogic.platform.designsystem.foundations.Sizes

@Composable
fun SimpleCard(
    modifier: Modifier = Modifier,
    onClick: (() -> Unit)? = null,
    content: @Composable () -> Unit,
) {
    val interactionSource = remember { MutableInteractionSource() }

    Surface(
        modifier = modifier
            .wrapContentSize(Alignment.TopCenter, false)
            .clip(Shapes.RoundCorner.regular)
            .fillMaxWidth()
            .conditionalClickable(
                interactionSource = interactionSource,
                indication = LocalIndication.current,
                onClick = onClick,
            ),
        shape = Shapes.RoundCorner.regular,
        border = BorderStroke(
            width = Sizes.Borders.Regular,
            color = MaterialTheme.colorScheme.outline,
        ),
    ) {
        content()
    }
}
