{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coachwatts-com/json-schema/coachwatts-com-nutrition-upload-schema.json",
  "title": "NutritionUpload",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coachwatts-com-openapi.yml#/components/schemas/NutritionUpload",
  "type": "object",
  "required": [
    "date"
  ],
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "YYYY-MM-DD or ISO string"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FoodItem"
      }
    },
    "calories": {
      "type": "integer",
      "description": "Optional override for daily total"
    },
    "carbs": {
      "type": "number",
      "description": "Optional override for daily total"
    },
    "protein": {
      "type": "number",
      "description": "Optional override for daily total"
    },
    "fat": {
      "type": "number",
      "description": "Optional override for daily total"
    },
    "waterMl": {
      "type": "integer"
    },
    "rawJson": {
      "type": "object",
      "description": "Raw developer data for historical reference"
    }
  },
  "$defs": {
    "FoodItem": {
      "type": "object",
      "required": [
        "logged_at"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Optional item name. Defaults to \"Unknown item\"."
        },
        "calories": {
          "type": "number"
        },
        "carbs": {
          "type": "number"
        },
        "protein": {
          "type": "number"
        },
        "fat": {
          "type": "number"
        },
        "fiber": {
          "type": "number"
        },
        "sugar": {
          "type": "number"
        },
        "logged_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 timestamp"
        },
        "absorptionType": {
          "type": "string",
          "enum": [
            "RAPID",
            "FAST",
            "BALANCED",
            "DENSE",
            "HYPER_LOAD"
          ],
          "default": "BALANCED"
        },
        "quantity": {
          "type": "string"
        }
      }
    }
  }
}