import Foundation struct GermanGameSummarizer: GameSummarizer { let game: GameSummary var winText: String { game.didWin ? "gewinnt" : "verliert" } var gameText: String { switch GameType(id: game.game)! { case .rufBlatt: return "den Ruf Blatt" case .rufEichel: return "den Ruf Eichel" case .rufSchelln: return "den Ruf Schelln" case .bettel: return "den Bettel" case .geier: return "den Geier" case .wenz: return "den Wenz" case .hochzeit: return "die Hochzeit" case .soloBlatt: return "das Solo Blatt" case .soloEichel: return "das Solo Eichel" case .soloHerz: return "das Solo Herz" case .soloSchelln: return "das Solo Schelln" } } var coPlayerNames: String { switch game.coPlayers.count { case 0: return "" case 1: return " mit \(game.coPlayers[0])" case 2: return " mit \(game.coPlayers[0]) und \(game.coPlayers[1])" default: return "" } } var costText: String { guard game.cost >= 100 else { return "\(game.cost) Cent" } return String(format: "%d.%02d €", game.cost / 100, game.cost % 100) } var text: String { "\(game.leader) \(winText) \(gameText)\(coPlayerNames) mit \(game.leaderPoints) Punkten. " + "Das Spiel kostet \(costText)." } }