package com.pixelized.desktop.lwa.repository.settings

import com.pixelized.desktop.lwa.repository.settings.model.Settings
import com.pixelized.desktop.lwa.usecase.SettingsUseCase
import kotlinx.coroutines.flow.StateFlow

class SettingsRepository(
    private val store: SettingsStore,
    private val useCase: SettingsUseCase,
) {
    fun settingsFlow(): StateFlow<Settings> = store.settingsFlow

    fun settings(): Settings = store.settingsFlow.value

    fun update(settings: Settings) {
        store.save(settings = settings)
    }

    fun reset() {
        store.save(settings = useCase.defaultSettings())
    }
}