Map<String, dynamic> toJson() { return { 'id': id, 'node_id': nodeId, 'type': type.name, 'position': {'x': position.x, 'y': position.y}, 'max_connections': connectionLimit, }; }