Map<String, Object?> toJson() => { 'input': input, 'selected': selected.toJson(), 'alternatives': [ for (final candidate in alternatives) candidate.toJson(), ], };