package com.pixelized.desktop.lwa.ui.composable.checkbox

import androidx.compose.runtime.Stable
import kotlinx.coroutines.flow.MutableStateFlow

@Stable
data class LwaCheckBoxFlow(
    val checkedFlow: MutableStateFlow<Boolean>,
)

@Stable
fun createLwaCheckBoxFlow(
    checked: Boolean,
): LwaCheckBoxFlow {
    return LwaCheckBoxFlow(
        checkedFlow = MutableStateFlow(checked),
    )
}

@Stable
fun LwaCheckBoxFlow.createLwaCheckBox(
    enable: Boolean = true,
    onCheckedChange: (Boolean) -> Unit = { checkedFlow.value = it },
): LwaCheckBoxUio {
    return LwaCheckBoxUio(
        enable = enable,
        checked = checkedFlow,
        onCheckedChange = onCheckedChange,
    )
}