package com.bravelocation.yeltzlandnew.viewmodels

import androidx.activity.ComponentActivity
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.bravelocation.yeltzlandnew.dataproviders.LocalSettingsManager
import com.bravelocation.yeltzlandnew.navigation.NavigationItem

class MainActivityViewModel constructor(val activity: ComponentActivity) {
    private val localSettingsManager = LocalSettingsManager(activity)

    private var _selectedRoute: MutableLiveData<String> = MutableLiveData(NavigationItem.Forum.route)
    val selectedRoute: LiveData<String> = _selectedRoute

    init {
        _selectedRoute.postValue(localSettingsManager.selectedTabRoute)
    }

    fun updateSelectedRoute(route: String) {
        localSettingsManager.updateSelectedRoute(route)
        _selectedRoute.postValue(localSettingsManager.selectedTabRoute)
    }
}