-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon-types.ts
61 lines (52 loc) · 1.23 KB
/
common-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as i from "immutable";
import * as option from "fp-ts/lib/Option";
export const none = option.none;
export const None = option.None;
export const some = option.some;
export const fromNullable = option.fromNullable;
export type Option<T> = option.Option<T>;
export type Hint = string;
export type GameId = string;
export type CardId = string;
export type PlayerId = string;
export type UserId = string;
export type Players = i.Map<PlayerId, Player>;
export type Cards = i.Map<CardId, Card>;
export interface Card {
id: CardId;
text: string;
team: Team;
flipped: boolean;
}
export enum Role {
Spymaster = "Spymaster",
Guesser = "Guesser"
}
export enum Team {
Assassin = "Assassin",
Bystander = "Bystander",
Team1 = "Team 1",
Team2 = "Team 2"
}
export type PlayerTeam = Team.Team1 | Team.Team2;
export interface Player {
id: PlayerId;
alias: Option<string>;
team: Option<PlayerTeam>;
role: Option<Role>;
}
export interface Game {
id: GameId;
// alais: Option<string>;
cards: Option<Cards>;
players: Players;
hasNecessaryPlayers: boolean;
started: boolean;
currentTeam: Option<PlayerTeam>;
hint: Option<Hint>;
hintSubmitted: Option<boolean>;
}
export enum Page {
Lobby = "Lobby",
Game = "Game"
}