package de.tsschulz.timeclock.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

object TcColors {
    val Background = Color.White
    val Text = Color.Black
    val TextMuted = Color(0xFF555555)
    val Border = Color(0xFFE0E0E0)
    val BorderSoft = Color(0xFFE0FFE0)
    val Navbar = Color(0xFFF0FFEC)
    val Card = Color(0xFFFAFAFA)
    val Button = Color(0xFFF5F5F5)
    val ButtonHover = Color(0xFFE5E5E5)
    val ButtonBorder = Color(0xFFCCCCCC)
    val Primary = Color(0xFF5BC0DE)
    val PrimaryBorder = Color(0xFF46B8DA)
    val PrimaryHover = Color(0xFF31B0D5)
    val Success = Color(0xFF5CB85C)
    val SuccessBorder = Color(0xFF4CAE4C)
    val Danger = Color(0xFFD9534F)
    val DangerBorder = Color(0xFFD43F3A)
    val Secondary = Color(0xFF6C757D)
    val InputBorder = Color(0xFFDDDDDD)
    val ActiveMenu = Color(0xFFE8F5E9)
    /** Login-Formular (Web: `.auth-form-container` / `h2`) */
    val FormSurface = Color.White
    val FormHeaderBg = Color(0xFFF5F5F5)
    val AuthErrorBg = Color(0xFFF2DEDE)
    val AuthErrorBorder = Color(0xFFEBCCD1)
    val AuthErrorText = Color(0xFFA94442)
    val GoogleText = Color(0xFF444444)
    val DividerText = Color(0xFF999999)
}

object TcSpacing {
    val Xs: Dp = 4.dp
    val Sm: Dp = 8.dp
    val Md: Dp = 12.dp
    val Lg: Dp = 16.dp
    val Xl: Dp = 24.dp
    val Xxl: Dp = 32.dp
    val WebContainer: Dp = 48.dp
}

object TcRadius {
    val Small: Dp = 3.dp
    val Medium: Dp = 4.dp
    val Card: Dp = 6.dp
    /** Web-Login-Container */
    val AuthPanel: Dp = 8.dp
}

private val TimeClockColorScheme = lightColorScheme(
    primary = TcColors.Primary,
    secondary = TcColors.Secondary,
    background = TcColors.Background,
    surface = TcColors.Background,
    surfaceVariant = TcColors.FormHeaderBg,
    surfaceContainer = TcColors.Background,
    surfaceContainerHigh = TcColors.FormSurface,
    outline = TcColors.Border,
    outlineVariant = TcColors.InputBorder,
    onPrimary = Color.White,
    onSecondary = Color.White,
    onBackground = TcColors.Text,
    onSurface = TcColors.Text,
    onSurfaceVariant = TcColors.TextMuted,
)

@Composable
fun TimeClockTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit,
) {
    MaterialTheme(
        colorScheme = TimeClockColorScheme,
        typography = MaterialTheme.typography,
        content = content,
    )
}
