Map<String, dynamic> toJson() { final type = this.type; final options = this.options; return { 'type': type.toValue(), if (options != null) 'options': options, }; }