Map<String, dynamic> toMap() { return {"total": total, "buckets": buckets.map((p) => p.toMap()).toList()}; }