package dev.ulfrx.recipe.ui.theme

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.lerp

data class RecipeGlass(
    val dock: RecipeGlassStyle,
    val dockPress: RecipeGlassStyle,
    val button: RecipeGlassStyle,
    val panel: RecipeGlassStyle,
    val chipOnGlass: RecipeGlassStyle,
)

fun recipeGlassFor(colors: RecipeColors): RecipeGlass =
    RecipeGlass(
        dock = RecipeGlassStyle(
            refraction = 0.5f,
            curve = 0.4f,
            edge = 0.03f,
            dispersion = 0f,
            saturation = 1f,
            contrast = 1f,
            frost = 2.dp,
            tint = colors.surfaceGlass,
        ),
        dockPress = RecipeGlassStyle(
            refraction = 0f,
            curve = 0f,
            edge = 0.03f,
            dispersion = 0.0f,
            saturation = 1f,
            contrast = 1f,
            frost = 0.dp,
        ),
        button = RecipeGlassStyle(
            refraction = 0.3f,
            curve = 0.2f,
            edge = 0.03f,
            dispersion = 0.5f,
            saturation = 1f,
            contrast = 0.85f,
            frost = 5.dp,
        ),
        panel = RecipeGlassStyle(
            refraction = 0f,
            curve = 0f,
            edge = 0.008f,
            dispersion = 0f,
            saturation = 1f,
            contrast = 1f,
            frost = 10.dp,
            tint = colors.surfaceGlass,
        ),
        chipOnGlass = RecipeGlassStyle(
            refraction = 0f,
            curve = 0f,
            edge = 0.1f,
            dispersion = 0.03f,
            saturation = 0.5f,
            contrast = 1.5f,
            frost = 5.dp,
        ),
    )

data class RecipeGlassStyle(
    val refraction: Float,
    val curve: Float,
    val edge: Float,
    val dispersion: Float,
    val saturation: Float,
    val contrast: Float,
    val frost: Dp,
    val tint: Color? = null,
)
