{
    "status": "ok",
    "message": "Mad API is running (database fully operational)",
    "db_server_time": "2026-11-05 21:22:13",
    "tables": [
        "auth_otp_challenges",
        "auth_sessions",
        "household_inventory",
        "household_locations",
        "household_users",
        "households",
        "ingredient_aliases",
        "inventory_movements",
        "meal_plan_days",
        "meal_plans",
        "products",
        "recipe_ingredients",
        "recipe_steps",
        "recipes",
        "shopping_list_items",
        "shopping_lists",
        "store_offers",
        "users"
    ],
    "tables_count": 18,
    "test_write": null,
    "endpoints": {
        "/api.php": "This status page",
        "/api.php?test=write": "Test database write",
        "/api.php?endpoint=scan": "POST scan ingest endpoint",
        "/api.php?endpoint=products": "Current inventory product list",
        "/api.php?endpoint=recent": "Recent inventory scan movements",
        "/api.php?endpoint=locations": "Household locations for authenticated user",
        "/api.php?endpoint=recipes": "GET household recipes for authenticated user (use include=details for ingredients/steps)",
        "/api.php?endpoint=recipes.create": "POST create recipe manually (title, ingredients, steps, servings, total_minutes)",
        "/api.php?endpoint=recipes.import_url": "POST import one recipe URL (Claude-first extraction + fallback parsing)",
        "/api.php?endpoint=recipes.extract_url": "POST extract one recipe URL to editable fields (no DB insert)",
        "/api.php?endpoint=recipes.delete": "DELETE one recipe by recipe_id for authenticated household",
        "/api.php?endpoint=mealplan.current": "GET meal plan for one week (week_start=YYYY-MM-DD)",
        "/api.php?endpoint=mealplan.set_day": "POST assign recipe to one day in meal plan",
        "/api.php?endpoint=shopping.candidates": "GET shopping candidates (minimum reached + manual list) with active offers",
        "/api.php?endpoint=shopping.list": "GET active shopping list for authenticated household",
        "/api.php?endpoint=shopping.list.offer_suggestions": "GET cross-store offer suggestions for one shopping list item",
        "/api.php?endpoint=shopping.offer_feed": "GET all scraped leaflet offers (also unmatched products)",
        "/api.php?endpoint=shopping.list.add_items": "POST add items to active shopping list from leaflet offers",
        "/api.php?endpoint=shopping.list.set_item_checked": "POST set checked/unchecked state for a shopping list item",
        "/api.php?endpoint=shopping.list.set_item_basis": "POST set basis flag for a shopping list item/product",
        "/api.php?endpoint=shopping.list.apply_offer": "POST apply one specific leaflet offer to a shopping list item",
        "/api.php?endpoint=shopping.list.update_item": "POST update quantity and preferred store for a shopping list item",
        "/api.php?endpoint=shopping.list.remove_item": "POST remove one shopping list item",
        "/api.php?endpoint=shopping.list.clear_checked": "POST remove all checked items from active shopping list",
        "/api.php?endpoint=auth.request_code": "POST request 2FA code by initials",
        "/api.php?endpoint=auth.verify_code": "POST verify 2FA code and issue access token",
        "/api.php?endpoint=auth.me": "GET current user from bearer token",
        "/api.php?endpoint=auth.test_sms": "POST send one test SMS by initials or phone number",
        "/api.php?endpoint=admin.users": "GET platform admin user overview",
        "/api.php?endpoint=admin.users.create": "POST create a user as platform admin",
        "/api.php?endpoint=admin.households": "GET platform admin household overview",
        "/api.php?endpoint=admin.households.create": "POST create a household as platform admin",
        "/api.php?endpoint=admin.households.assign_user": "POST assign a user to a household as platform admin",
        "/api.php?endpoint=ai.meal_ideas": "POST AI meal ideas from household inventory (Anthropic)",
        "/api.php?endpoint=nutrition.quality": "GET nutrition data quality summary (platform admin)",
        "/api.php?endpoint=nutrition.match.run": "POST run Frida-style nutrition auto match (platform admin)",
        "/api.php?endpoint=ingredients.lookup&barcode=...": "GET ingredient lookup by barcode (authenticated)",
        "/api.php?endpoint=ingredients.create": "POST create ingredient with inventory + price/offer metadata (authenticated)",
        "/": "Live test dashboard"
    }
}