def format_trip_summary(record: dict) -> str: name = record.get("name", "Someone") city = record.get("destinationName") or record.get("locationName") start = record.get("startDate") end = record.get("endDate") start_str = start.strftime("%Y-%m-%d") if start else "" end_str = end.strftime("%Y-%m-%d") if end else "" date_range = f"{start_str} to {end_str}" rating = record.get("rating") accommodation = record.get("accommodation") companion = record.get("companionType") budget = record.get("budgetStyle") highlights = record.get("highlights") food = record.get("memorableFood") impression = record.get("deepestImpressionSpot") tips = record.get("travelTips") itinerary = record.get("dailyBriefItinerary") tags = ", ".join(record.get("keywordTags", [])) summary = f"**{name}'s Trip to {city}**\n" summary += f"Date: {date_range}\n" if rating: summary += f"⭐ Rating: {rating}/5\n" if accommodation: summary += f"šŸØ Stayed at: {accommodation}\n" if companion: summary += f"šŸ§‘ā€šŸ¤ā€šŸ§‘ With: {companion}\n" if budget: summary += f"šŸ’° Budget Style: {budget}\n" if tags: summary += f"šŸ·ļø Tags: {tags}\n" if highlights: summary += f"\n✨ Highlights:\n{highlights}\n" if food: summary += f"\nšŸœ Memorable Food:\n{food}\n" if impression: summary += f"\nšŸ“ Impression Spot:\n{impression}\n" if tips: summary += f"\nšŸ“ Tips:\n{tips}\n" if itinerary: summary += f"\nšŸ“… Itinerary:\n{itinerary}\n" return summary