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