2021-11-27 11:59:13 +01:00
|
|
|
import Foundation
|
|
|
|
|
2021-12-03 18:03:29 +01:00
|
|
|
struct TableInfo: Codable {
|
2021-12-01 22:49:54 +01:00
|
|
|
|
2021-11-27 11:59:13 +01:00
|
|
|
let id: String
|
|
|
|
|
|
|
|
let name: String
|
2021-12-03 18:03:29 +01:00
|
|
|
|
2021-12-20 20:18:19 +01:00
|
|
|
var player: PlayerInfo = .init(name: "")
|
2021-12-03 18:03:29 +01:00
|
|
|
|
2021-12-20 20:18:19 +01:00
|
|
|
var playerLeft: PlayerInfo? = nil
|
2021-12-03 18:03:29 +01:00
|
|
|
|
2021-12-20 20:18:19 +01:00
|
|
|
var playerAcross: PlayerInfo? = nil
|
2021-12-03 18:03:29 +01:00
|
|
|
|
2021-12-20 20:18:19 +01:00
|
|
|
var playerRight: PlayerInfo? = nil
|
2021-12-06 18:28:35 +01:00
|
|
|
|
2021-12-20 20:18:19 +01:00
|
|
|
var playableGames: [GameId] = []
|
2021-12-09 11:11:17 +01:00
|
|
|
|
|
|
|
/// The cards in the hand of the player
|
2021-12-20 20:18:19 +01:00
|
|
|
var cards: [CardInfo] = []
|
2021-12-09 11:11:17 +01:00
|
|
|
|
|
|
|
/// The action the player can perform
|
2021-12-20 20:18:19 +01:00
|
|
|
var actions: [ActionId] = []
|
|
|
|
|
|
|
|
var playerSelectsGame = false
|
|
|
|
|
|
|
|
var game: GameId? = nil
|
2021-12-21 09:53:42 +01:00
|
|
|
|
2021-12-21 11:16:54 +01:00
|
|
|
var summary: GameSummary?
|
2021-12-20 20:18:19 +01:00
|
|
|
|
|
|
|
init(id: TableId, name: TableName) {
|
|
|
|
self.id = id
|
|
|
|
self.name = name
|
2021-12-01 22:49:54 +01:00
|
|
|
}
|
2021-11-27 11:59:13 +01:00
|
|
|
}
|
|
|
|
|
2021-12-03 18:03:29 +01:00
|
|
|
extension TableInfo {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-11-27 11:59:13 +01:00
|
|
|
extension TableInfo: Comparable {
|
|
|
|
|
|
|
|
static func < (lhs: TableInfo, rhs: TableInfo) -> Bool {
|
|
|
|
lhs.name < rhs.name
|
|
|
|
}
|
|
|
|
}
|