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