package com.applemand.zmanim.feature.calendar

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.applemand.zmanim.core.settings.SettingsRepository
import com.applemand.zmanim.core.settings.proto.UserSettings
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.stateIn
import javax.inject.Inject

@HiltViewModel
class CalendarSettingsViewModel @Inject constructor(
    repo: SettingsRepository,
) : ViewModel() {
    val state: StateFlow<UserSettings?> = repo.settings
        .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), null)
}
