Schafkopf-Server/Sources/App/Model/Tables/ManageableTable.swift
2021-12-22 22:13:09 +01:00

35 lines
913 B
Swift

import Foundation
import WebSocketKit
protocol ManageableTable {
/// The unique id of the table
var id: UUID { get }
/// 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 }
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()
}