import Foundation
import MultipeerConnectivity

struct PeerUser: Identifiable, Hashable {
    let id: MCPeerID
    let nodeID: String // Stable identifier from handshake (for reliable identity)
    let name: String
    let colorHex: String
    let role: UserRole // Role from handshake (for data integrity)
    
    init(peerID: MCPeerID, nodeID: String = "", name: String? = nil, colorHex: String = "#808080", role: UserRole = .hearing) {
        self.id = peerID
        self.nodeID = nodeID
        self.name = name ?? peerID.displayName
        self.colorHex = colorHex
        self.role = role
    }
}
