package com.gamedog.vididin.main.fragments.mine

import androidx.lifecycle.viewModelScope
import com.ama.core.architecture.appBase.vm.AppViewModel
import com.gamedog.vididin.core.datastore.AppPreferencesDataSource
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.launch
import javax.inject.Inject
import com.gamedog.vididin.main.fragments.mine.MineUiState as UiState


@HiltViewModel
class MineViewModel @Inject constructor(
    private val preferencesDataSource: AppPreferencesDataSource,
) : AppViewModel<UiState>() {
    override val uiStateInitialValue: UiState = UiState()

    override val uiStateFlow: Flow<UiState> = flowOf()
    fun updateDynamicColorPreference(useDynamicColor: Boolean, finish: () -> Unit) {
        if (useDynamicColor == uiState.value.useDynamicColor) return
        viewModelScope.launch {
            delay(250)
            finish()
        }
    }
}

data class MineUiState(
    val useDynamicColor: Boolean = false,
)