Schafkopf-Server/Sources/App/Infos/TableInfo.swift
Christoph Hagen 3db9652cad Sync push
2021-12-03 18:03:29 +01:00

38 lines
854 B
Swift

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
}
}