summaryrefslogtreecommitdiff
path: root/frontend/src/api/model.js
blob: 5d1f92c6f0f0c43efe5b9d563b888706b155f63d (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// @flow
export type ApiError = {
  message: string,
  details: ApiErrorDetail[]
};

export type ApiErrorDetail = {
  message: string
};

export type ApiGameState = "LOBBY" | "PLAYING";

export type ApiLobby = {
  id: number,
  name: string,
  owner: ApiPlayer,
  players: ApiPlayer[],
  settings: ApiSettings,
  state: ApiGameState
};

export type ApiWonderSidePickMethod = "EACH_RANDOM" | "ALL_A" | "ALL_B" | "SAME_RANDOM_FOR_ALL";

export type ApiSettings = {
  randomSeedForTests: number,
  timeLimitInSeconds: number,
  wonderSidePickMethod: ApiWonderSidePickMethod,
  initialGold: number,
  discardedCardGold: number,
  defaultTradingCost: number,
  pointsPer3Gold: number,
  lostPointsPerDefeat: number,
  wonPointsPerVictoryPerAge: Map<number, number>
};

export type ApiPlayer = {
  username: string,
  displayName: string,
  index: number,
  ready: boolean
};

export type ApiTable = {};

export type ApiAction = {};

export type ApiHandCard = {};

export type ApiCard = {};

export type ApiPreparedCard = {};

export type ApiPlayerTurnInfo = {
  playerIndex: number,
  table: ApiTable,
  currentAge: number,
  action: ApiAction,
  hand: ApiHandCard[],
  neighbourGuildCards: ApiCard[],
  message: string
};

export type ApiMoveType = "PLAY" | "PLAY_FREE" | "UPGRADE_WONDER" | "DISCARD" | "COPY_GUILD";
export type ApiProvider = "LEFT_NEIGHBOUR" | "RIGHT_NEIGHBOUR";
export type ApiResourceType = "WOOD" | "STONE" | "ORE" | "CLAY" | "GLASS" | "PAPYRUS" | "LOOM";

export type ApiResources = {
  quantities: Map<ApiResourceType, number>
};
export type ApiBoughtResources = {
  provider: ApiProvider,
  resources: ApiResources
};

export type ApiPlayerMove = {
  type: ApiMoveType,
  cardName: string,
  boughtResources: ApiBoughtResources[]
};
bgstack15