2021-12-21 09:53:42 +01:00
|
|
|
import Foundation
|
|
|
|
|
2021-12-21 11:16:54 +01:00
|
|
|
struct GameSummary: Codable, Equatable {
|
2021-12-21 09:53:42 +01:00
|
|
|
|
2021-12-21 14:24:53 +01:00
|
|
|
let selector: PlayerName
|
2021-12-21 09:53:42 +01:00
|
|
|
|
|
|
|
let coPlayers: [PlayerName]
|
|
|
|
|
|
|
|
let didWin: Bool
|
|
|
|
|
|
|
|
let game: GameId
|
|
|
|
|
2021-12-21 14:24:53 +01:00
|
|
|
let points: Int
|
2021-12-21 09:53:42 +01:00
|
|
|
|
|
|
|
let cost: Int
|
|
|
|
|
|
|
|
var text: String = ""
|
|
|
|
|
|
|
|
init(table: FinishedTable, language: SupportedLanguage) {
|
2021-12-21 14:24:53 +01:00
|
|
|
self.selector = table.gameSelector.name
|
|
|
|
self.coPlayers = table.coPlayers.map { $0.name }
|
2021-12-21 09:53:42 +01:00
|
|
|
self.game = table.game.id
|
2021-12-21 14:24:53 +01:00
|
|
|
self.points = table.selectorTeamPoints
|
|
|
|
self.didWin = table.selectorDidWin
|
|
|
|
self.cost = table.cost
|
|
|
|
self.text = language.gameSummarizer.init(table: table).text
|
2021-12-21 09:53:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|