import Foundation

struct PublicTableInfo: Codable {
    
    let id: TableId

    let name: TableName

    let players: [PlayerName]
    
    let tableIsFull: Bool
    
    init(id: TableId, name: String, players: [PlayerName]) {
        self.id = id
        self.name = name
        self.players = players
        self.tableIsFull = players.count == maximumPlayersPerTable
    }
}

extension PublicTableInfo: Comparable {

    static func < (lhs: PublicTableInfo, rhs: PublicTableInfo) -> Bool {
        lhs.name < rhs.name
    }
}

