Map<String, Object?> toJson() => { 'kind': kind.name, 'name': name, if (definition != null) 'definition': definition!.toJson(), };