package com.pixelized.desktop.lwa.ui.theme.dimen

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp

@Stable
data class LwaDimen(
    val paddingValue: Dp,
    val paddingValues: PaddingValues,
    val layout: Layout,
    val portrait: Portrait,
    val sheet: Sheet,
    val debug: Debug,
) {
    @Stable
    data class Layout(
        val panelWidth: Dp,
        val detailWidth: Dp,
        val chatMaxWidth: Dp,
    )

    @Stable
    data class Portrait(
        val minimized: DpSize,
    )

    @Stable
    data class Sheet(
        val subCategory: Dp,
        val characteristic: DpSize,
    )

    @Stable
    data class Debug(
        val panelWidth: Dp,
        val offset: Dp,
    )
}

@Composable
@Stable
fun lwaDimen(
    paddingValue: Dp = 8.dp,
    paddingValues: PaddingValues = PaddingValues(all = paddingValue),
    portrait: LwaDimen.Portrait = LwaDimen.Portrait(
        minimized = DpSize(width = 96.dp, height = 128.dp) * 1.14f,
    ),
    sheet: LwaDimen.Sheet = LwaDimen.Sheet(
        subCategory = 14.dp,
        characteristic = DpSize(width = 96.dp, height = 128.dp),
    ),
    layout: LwaDimen.Layout = LwaDimen.Layout(
        panelWidth = portrait.minimized.width + paddingValue * 2,
        detailWidth = 128.dp * 4,
        chatMaxWidth = 600.dp,
    ),
    debug: LwaDimen.Debug = LwaDimen.Debug(
        panelWidth = 200.dp,
        offset = 8.dp,
    )
): LwaDimen {
    return remember {
        LwaDimen(
            paddingValue = paddingValue,
            paddingValues = paddingValues,
            portrait = portrait,
            sheet = sheet,
            layout = layout,
            debug = debug,
        )
    }
}