package com.hermes.app.feature.result

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Cancel
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.hermes.app.core.designsystem.HermesColors
import com.hermes.app.core.designsystem.HermesMetricChip
import com.hermes.app.core.designsystem.HermesPrimaryButton
import com.hermes.app.core.designsystem.HermesSectionHeader

@Composable
fun ResultPanel(
    title: String,
    subtitle: String,
    selectionLabel: String,
    selectionValue: String,
    outcomeLabel: String,
    outcomeValue: String,
    didWin: Boolean,
    winLabel: String,
    loseLabel: String,
    nextRoundTitle: String,
    onNextRound: () -> Unit,
    modifier: Modifier = Modifier,
) {
    Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(12.dp)) {
        HermesSectionHeader(title = title, subtitle = subtitle)

        Row(horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth()) {
            HermesMetricChip(label = selectionLabel, value = selectionValue, modifier = Modifier.fillMaxWidth(0.5f))
            HermesMetricChip(label = outcomeLabel, value = outcomeValue, modifier = Modifier.fillMaxWidth(0.5f))
        }

        Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
            Icon(
                imageVector = if (didWin) Icons.Filled.CheckCircle else Icons.Filled.Cancel,
                contentDescription = null,
                tint = if (didWin) HermesColors.positive else HermesColors.warning,
            )
            Text(
                text = if (didWin) winLabel else loseLabel,
                style = MaterialTheme.typography.titleMedium,
                color = HermesColors.textPrimary,
            )
        }

        HermesPrimaryButton(text = nextRoundTitle, onClick = onNextRound)
    }
}
