package de.trainingstagebuch.app.network

import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import de.trainingstagebuch.app.utils.UiEventFlowUtils

object AuthEventBus {
    private val _unauthorizedEvents = UiEventFlowUtils.createEventFlow<Unit>(extraBufferCapacity = 1)
    val unauthorizedEvents: SharedFlow<Unit> = _unauthorizedEvents.asSharedFlow()

    fun notifyUnauthorized() {
        UiEventFlowUtils.emitSafe(_unauthorizedEvents, Unit)
    }
}
