@override Object toJson() => { 'parent': parent, if (metric case final metric?) 'metric': metric.toJson(), };