package com.fabledsword.minstrel.shared.widgets

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import com.fabledsword.minstrel.connectivity.NetworkStatusController
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 * Routes a deliberate pull-to-refresh into a /healthz recheck so the connection
 * banner clears within seconds rather than waiting for the next poll — even on
 * cache-only screens whose own refresh never touches the network. Backs
 * [PullToRefreshScaffold].
 */
@HiltViewModel
class PullRefreshNetworkViewModel @Inject constructor(
    private val networkStatus: NetworkStatusController,
    @Suppress("UnusedPrivateProperty") savedStateHandle: SavedStateHandle,
) : ViewModel() {
    fun recheck() = networkStatus.recheck()
}
