package id.iiyh.inatrading.feature.news.presentation

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import id.iiyh.inatrading.feature.news.data.model.NewsArticle
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import javax.inject.Inject

/** Shared ViewModel untuk passing NewsArticle ke detail screen tanpa serialisasi */
@HiltViewModel
class NewsNavViewModel @Inject constructor() : ViewModel() {

    private val _selectedArticle = MutableStateFlow<NewsArticle?>(null)
    val selectedArticle: StateFlow<NewsArticle?> = _selectedArticle.asStateFlow()

    fun select(article: NewsArticle) {
        _selectedArticle.value = article
    }
}
