*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'periodStart' => $this->period_start?->toDateString(), 'periodEnd' => $this->period_end?->toDateString(), 'averages' => [ 'calories' => $this->average_calories, 'proteins' => $this->average_proteins, 'carbs' => $this->average_carbs, 'fats' => $this->average_fats, ], 'loggedDaysCount' => $this->logged_days_count, 'weightEntriesCount' => $this->weight_entries_count, 'weightTrendKg' => $this->weight_trend_kg, 'targetWeightTrendKg' => $this->target_weight_trend_kg, 'status' => $this->status, 'recommendedCalorieAdjustment' => $this->recommended_calorie_adjustment, 'messageCode' => $this->message_code, 'metrics' => $this->metrics, 'generatedAt' => $this->generated_at?->toISOString(), 'acceptedAt' => $this->accepted_at?->toISOString(), 'acceptedNutritionPlanId' => $this->accepted_nutrition_plan_id, ]; } }