Schafkopf-Server/Sources/App/Model/Tables/ManageableTable.swift

35 lines
913 B
Swift
Raw Normal View History

2021-12-18 15:08:43 +01:00
import Foundation
import WebSocketKit
protocol ManageableTable {
/// The unique id of the table
var id: UUID { get }
2021-12-18 15:08:43 +01:00
/// The name of the table
var name: TableName { get }
/// The table is visible in the list of tables and can be joined by anyone
var isPublic: Bool { get }
var leavePenalty: Int { get }
2021-12-18 15:08:43 +01:00
var playerNames: [PlayerName] { get }
var allPlayers: [Player] { get }
var publicInfo: PublicTableInfo { get }
func tableInfo(forPlayer player: PlayerName) -> TableInfo
func perform(action: PlayerAction, forPlayer: PlayerName) -> (result: PlayerActionResult, table: ManageableTable?)
func play(card: Card, player name: PlayerName) -> (result: PlayerActionResult, table: ManageableTable?)
func connect(player name: PlayerName, using socket: WebSocket) -> Bool
func disconnect(player name: PlayerName)
func sendUpdateToAllPlayers()
}