package com.tsmobile.app.ui.theme

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

object UiTokens {
    object Spacing {
        val None: Dp = 0.dp
        val ExtraSmall: Dp = 4.dp
        val Small: Dp = 8.dp
        val Medium: Dp = 12.dp
        val Large: Dp = 16.dp
        val ExtraLarge: Dp = 24.dp
        val Huge: Dp = 32.dp
    }

    object Size {
        val IconSmall: Dp = 16.dp
        val IconMedium: Dp = 20.dp
        val IconLarge: Dp = 24.dp
        val TouchTarget: Dp = 48.dp
        val ControlHeight: Dp = 40.dp
        val AppBarHeight: Dp = 56.dp
    }

    object Elevation {
        val None: Dp = 0.dp
        val Subtle: Dp = 1.dp
        val Raised: Dp = 3.dp
        val Floating: Dp = 6.dp
    }

    object Border {
        val Hairline: Dp = 1.dp
        val Emphasized: Dp = 2.dp
    }
}

@Immutable
data class SemanticColors(
    val success: Color,
    val onSuccess: Color,
    val successContainer: Color,
    val onSuccessContainer: Color,
    val warning: Color,
    val onWarning: Color,
    val warningContainer: Color,
    val onWarningContainer: Color,
    val info: Color,
    val onInfo: Color,
    val infoContainer: Color,
    val onInfoContainer: Color,
)

internal val LocalSemanticColors = staticCompositionLocalOf<SemanticColors> {
    error("Semantic colors are available only within TSMobileTheme.")
}

val MaterialTheme.semanticColors: SemanticColors
    @Composable get() = LocalSemanticColors.current
