diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-10 23:06:00 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-11 02:16:49 +0100 |
commit | eef32bd9307a3a9f1ee3b532db2fb1f7cf37927a (patch) | |
tree | f139487db3866a687e699a01f3ed4baa5e44faf2 /sw-common-model/src/commonMain | |
parent | Decouple some sagas from routes (diff) | |
download | seven-wonders-eef32bd9307a3a9f1ee3b532db2fb1f7cf37927a.tar.gz seven-wonders-eef32bd9307a3a9f1ee3b532db2fb1f7cf37927a.tar.bz2 seven-wonders-eef32bd9307a3a9f1ee3b532db2fb1f7cf37927a.zip |
Allow owner to leave/disband the game
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/51
Diffstat (limited to 'sw-common-model/src/commonMain')
-rw-r--r-- | sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt | 26 |
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, |