Serializes the plan into a persistence-friendly map.
Map<String, dynamic> toMap() => { 'steps': steps.map((step) => step.toMap()).toList(), 'metadata': metadata, };