package club.clubk.ktag.apps.medic.ui

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
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.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import club.clubk.ktag.apps.medic.R

@Composable
fun KothStatusBar(
    possessionText: String,
    possessionColor: Color,
    modifier: Modifier = Modifier
) {
    Row(
        modifier = modifier
            .fillMaxWidth()
            .padding(8.dp),
        verticalAlignment = Alignment.CenterVertically
    ) {
        // Flag image with colored background
        Box(
            modifier = Modifier.size(100.dp),
            contentAlignment = Alignment.Center
        ) {
            // Color indicator behind the flag
            Box(
                modifier = Modifier
                    .size(75.dp)
                    .background(possessionColor)
            )
            // King of the Hill flag image
            Image(
                painter = painterResource(id = R.drawable.king_of_the_hill),
                contentDescription = "King of the Hill",
                modifier = Modifier.size(100.dp)
            )
        }

        // Possession text
        Text(
            text = possessionText,
            style = MaterialTheme.typography.bodyLarge,
            modifier = Modifier
                .weight(1f)
                .padding(start = 16.dp, end = 8.dp)
        )
    }
}
