package de.krisenvorrat.app.data.sync

import de.krisenvorrat.shared.model.MessageDto
import kotlinx.coroutines.flow.SharedFlow

internal interface WebSocketClient {
    val events: SharedFlow<WebSocketEvent>
    fun connect(serverUrl: String, accessToken: String)
    fun disconnect()
}

internal sealed interface WebSocketEvent {
    data class InventoryUpdated(val itemId: String) : WebSocketEvent
    data object FullSyncRequired : WebSocketEvent
    data object Connected : WebSocketEvent
    data object Disconnected : WebSocketEvent
    data class ConnectionFailed(val message: String) : WebSocketEvent
    data class NewMessage(val message: MessageDto) : WebSocketEvent
}
