Map<String, Object?> toJson() { final key = this.key; return { if (key != null) 'key': key.name, }; }