Created
December 26, 2019 19:34
-
-
Save Swoorup/c2792aace791f1d8961a984e49cc2605 to your computer and use it in GitHub Desktop.
pollutant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Snl.Api.V1.Types where | |
import Data.Aeson | |
import Data.Proxy | |
import Data.Swagger | |
import Data.Time | |
import Data.UUID as UUID | |
import GHC.Generics | |
import Servant.API | |
import Snl.Core.Types | |
data Entity record = | |
Entity | |
{ entityId :: Id record | |
, entityRecord :: record | |
} | |
newtype Id record = | |
Id UUID | |
deriving (Eq, Show, Generic) | |
deriving anyclass (ToJSON, FromJSON) | |
deriving newtype (FromHttpApiData) | |
type GameId = Id GameInfo | |
type LobbyId = Id Lobby | |
data GameState | |
= WaitingForPlayer | |
| InProgress | |
| Finished | |
deriving (Generic, ToJSON, FromJSON, Show, Eq) | |
data GameInfo = | |
GameInfo | |
{ gameId :: GameId | |
, numPlayers :: Int | |
, gameState :: GameState | |
} | |
deriving (Eq, Show, Generic, ToJSON, FromJSON) | |
data Lobby = | |
Lobby | |
{ lobbyId :: LobbyId | |
, lobbyCreator :: PlayerId | |
, players :: [PlayerId] | |
, game :: GameInfo | |
} | |
data NewLobby = | |
NewLobby | |
{ lobbyCreator :: PlayerId | |
, players :: [PlayerId] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment