package de.tsschulz.timeclock.ui.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
import de.tsschulz.timeclock.ui.theme.TcColors
import de.tsschulz.timeclock.ui.theme.TcSpacing

@Composable
fun TcLoading(text: String = "Lädt...") {
    TcCard {
        Text(text = text, color = TcColors.TextMuted, fontSize = 14.sp)
    }
}

@Composable
fun TcError(message: String) {
    TcCard {
        Text(text = "Fehler", color = TcColors.Danger, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)
        Text(text = message, color = TcColors.TextMuted, fontSize = 14.sp, modifier = Modifier.padding(top = TcSpacing.Sm))
    }
}

@Composable
fun TcEmptyState(title: String, message: String) {
    Column(
        modifier = Modifier.fillMaxWidth().padding(TcSpacing.Xl),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.spacedBy(TcSpacing.Sm),
    ) {
        Text(text = title, color = TcColors.Text, fontSize = 18.sp, fontWeight = FontWeight.SemiBold)
        Text(text = message, color = TcColors.TextMuted, fontSize = 14.sp)
    }
}
