package com.laseroptek.raman.ui.screens.config

import android.content.Context
import androidx.lifecycle.ViewModel
import com.laseroptek.raman.repository.DatabaseRepository
import com.laseroptek.raman.repository.PreferenceRepository
import com.laseroptek.raman.repository.SerialPortRepository
import com.laseroptek.raman.utils.DispatcherProvider
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
class ConfigViewModel @Inject constructor(
    private val preferenceRepository: PreferenceRepository,
    private val serialPortRepository: SerialPortRepository,
    private val databaseRepository: DatabaseRepository,
    private val dispatcherProvider: DispatcherProvider,
    private val applicationContext: Context,
) : ViewModel() {
    // volumeLevel
    /*
    private val _volumeLevel = MutableStateFlow(0f) // Keep the MutableStateFlow private
    val volumeLevel = _volumeLevel.asStateFlow()         // Expose an immutable StateFlow
    fun setVolumeLevel(level: Float) {
        _volumeLevel.value = level
    }
    */

    // sliderVolume
    /*
    private val _sliderVolume = MutableStateFlow(0f) // Keep the MutableStateFlow private
    val sliderVolume = _sliderVolume.asStateFlow()         // Expose an immutable StateFlow
    fun setSliderVolume(volume: Float) {
        _sliderVolume.value = volume
    }
    */

    // sliderVolume (prev - for restore to un mute state)
    private val _prevSliderVolume = MutableStateFlow(0f) // Keep the MutableStateFlow private
    val prevSliderVolume = _prevSliderVolume.asStateFlow()         // Expose an immutable StateFlow
    fun setPrevSliderVolume(volume: Float) {
        _prevSliderVolume.value = volume
    }

    init {
        Timber.d("ConfigViewModel init")
    }
}