import Foundation

struct GameSummary: Codable, Equatable {

    let selector: PlayerName

    let coPlayers: [PlayerName]

    let didWin: Bool

    let game: GameId

    let points: Int

    let cost: Int

    var text: String = ""

    init(table: FinishedTable, language: SupportedLanguage) {
        self.selector = table.gameSelector.name
        self.coPlayers = table.coPlayers.map { $0.name }
        self.game = table.game.id
        self.points = table.selectorTeamPoints
        self.didWin = table.selectorDidWin
        self.cost = table.cost
        self.text = language.gameSummarizer.init(table: table).text
    }

}
