{
  "schema_version": "visual-recipe-v0.5",
  "module_id": "mealplan",
  "name": "Meal Planning",
  "source_nav_id": "mealplan",
  "user_facing_name": "Meal Plan",
  "purpose": "Plan meals for the week. Auto-generate or hand-pick. Track what was cooked + who ate + ratings.",
  "behaviour": {
    "structure": "weeks → days → meals (breakfast/lunch/dinner/extras)",
    "auto_generate": "generateMealPlan, generateRandomPlan",
    "drag_recipe_to_slot": true,
    "extras_per_day": "pudding/snack (Extras modal)",
    "weekly_staples": "recurring items (milk, bread) added to shopping",
    "meal_swap": "replace one meal with another (confirmReplaceMeal)",
    "complete_meal": "mark as cooked (move stock, log to history)",
    "ratings": "1-5 stars per meal",
    "attendance": "track who ate each meal (multi-person households)"
  },
  "data": {
    "weeks": "pantry_mealplan_weeks (localStorage)",
    "completed_meals": "pantry_completedMeals (localStorage)",
    "attendance": "pantry_mealAttendance (localStorage)",
    "cook_history": "pantry_mealCompletionHistory (localStorage)",
    "combos": "pantry_mealCombos_v2 (localStorage)",
    "notes": "pantry_mealNotes (localStorage)",
    "ratings": "pantry_mealRatings_v2 (localStorage)",
    "dislikes": "pantry_mealDislikes (localStorage)",
    "restrictions": "pantry_mealRestrictions (localStorage)"
  },
  "key_functions": [
    "generatePlan",
    "generateRandomPlan",
    "getDefaultPlan",
    "getDayContext",
    "getFilteredMealList",
    "getDaysSinceLastCooked",
    "getDaysUntilExpiry",
    "adjustStockForMeal",
    "filterDayMeal",
    "applyAllMealUpdates",
    "applyDMealUpdate",
    "deleteMealFromPlan",
    "confirmAddToPlan",
    "confirmReplaceMeal",
    "expandTodayListItem",
    "addCustomExtra",
    "addWeeklyStaple"
  ],
  "files": {
    "html": "app/index.html#mealplan-tab",
    "css": "app/styles.css (meal grid + day column classes)",
    "js": "app/modules/mealplan.js"
  },
  "tests": [
    "Generate plan fills the week",
    "Drag recipe to slot adds it",
    "Replace meal asks for confirmation",
    "Complete meal moves ingredients from stock",
    "Weekly staples appear in shopping list",
    "Rating persists per meal"
  ]
}