import Foundation struct TableInfo: Codable { let id: String let name: String let player: PlayerInfo let playerLeft: PlayerInfo? let playerAcross: PlayerInfo? let playerRight: PlayerInfo? init(_ table: Table, forPlayerAt playerIndex: Int) { self.id = table.id self.name = table.name self.player = table.player(at: playerIndex)!.info(masked: false) self.playerLeft = table.player(leftOf: playerIndex)?.info(masked: true) self.playerAcross = table.player(acrossOf: playerIndex)?.info(masked: true) self.playerRight = table.player(rightOf: playerIndex)?.info(masked: true) } } extension TableInfo { } extension TableInfo: Comparable { static func < (lhs: TableInfo, rhs: TableInfo) -> Bool { lhs.name < rhs.name } }