summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt26
1 files changed, 26 insertions, 0 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
index e1e978f7..62bac3b1 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
@@ -1,10 +1,36 @@
package org.luxons.sevenwonders.model.api
+import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.luxons.sevenwonders.model.wonders.PreGameWonder
const val SEVEN_WONDERS_WS_ENDPOINT = "/seven-wonders-websocket"
+// workaround for https://github.com/Kotlin/kotlinx.serialization/issues/1194
+@Serializable
+data class GameListEventWrapper(
+ val event: GameListEvent
+)
+
+fun GameListEvent.wrap(): GameListEventWrapper = GameListEventWrapper(this)
+
+@Serializable
+sealed class GameListEvent {
+
+ @SerialName("ReplaceList")
+ @Serializable
+ data class ReplaceList(val lobbies: List<LobbyDTO>) : GameListEvent()
+
+ @SerialName("CreateOrUpdate")
+ @Serializable
+ data class CreateOrUpdate(val lobby: LobbyDTO) : GameListEvent()
+
+ @SerialName("Delete")
+ @Serializable
+ data class Delete(val lobbyId: Long) : GameListEvent()
+}
+
+@Serializable
enum class State {
LOBBY,
PLAYING,
bgstack15