package com.example.elva.ui.alerts

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch

@HiltViewModel
class AlertsViewModel @Inject constructor() : ViewModel() {

    private val _state = MutableStateFlow(AlertsState())
    val state: StateFlow<AlertsState> = _state

    fun loadAlerts() {
        viewModelScope.launch {
            _state.value = AlertsState(isLoading = true)
            _state.value = AlertsState(alerts = listOf("Тестовый алерт"))
        }
    }
}

data class AlertsState(
    val isLoading: Boolean = false,
    val error: String? = null,
    val alerts: List<String> = emptyList()
)

