import Foundation

struct MeshMessage: Codable, Identifiable, Hashable {
    var id: UUID
    var senderID: String // MCPeerID.displayName (for display purposes)
    var senderNodeID: String = "" // Stable node ID per install
    var senderInstance: Int = 0 // Monotonic instance ID to detect ghosts/restarts
    var senderRole: UserRole
    var senderColorHex: String
    var content: String
    var isTranscription: Bool // True = Audio source, False = Typed source
    var isPartial: Bool = false // True = Live partial result, False = Final confirmed result
    var isHandshake: Bool = false // True = Handshake message with user details
    var isKeepAlive: Bool = false // True = Heartbeat to maintain AWDL links (ignore in UI)
    var connectedNodeIDs: [String]? = nil // Gossip: List of NodeIDs this peer is connected to (for clique repair)
    var timestamp: Date
}
