{
  "formatVersion": 1,
  "experienceId": "meal-journal",
  "revision": 1,
  "minHostVersion": "0.1.0",
  "title": "Good Plate",
  "subtitle": "A photo, an estimate, a more useful food journal.",
  "icon": "restaurant",
  "tint": "#FFB18E",
  "runtime": "native",
  "tables": [
    {
      "id": "wellness.meals",
      "name": "Meal journal",
      "fields": [
        {
          "name": "title",
          "type": "string",
          "required": true
        },
        {
          "name": "photo",
          "type": "image",
          "required": false
        },
        {
          "name": "calories",
          "type": "number",
          "required": false
        },
        {
          "name": "protein",
          "type": "number",
          "required": false
        },
        {
          "name": "notes",
          "type": "string",
          "required": false
        },
        {
          "name": "date",
          "type": "date",
          "required": false
        }
      ]
    }
  ],
  "seeds": [],
  "dataBindings": [
    {
      "tableId": "wellness.meals",
      "access": "write"
    }
  ],
  "capabilities": [
    "camera",
    "photos",
    "network:https://api.openai.com"
  ],
  "connections": [
    {
      "id": "meal-analysis",
      "kind": "openai.vision",
      "url": "https://api.openai.com/v1/responses",
      "method": "POST",
      "credentialId": "openai.personal",
      "credentialHeader": "Authorization",
      "credentialPrefix": "Bearer ",
      "headers": {},
      "saveToTableId": "wellness.meals",
      "fieldMapping": {
        "title": "title",
        "calories": "calories",
        "protein": "protein",
        "notes": "notes"
      },
      "model": "",
      "prompt": "Estimate the visible meal. Return JSON with title (string), calories (number), protein (number, grams), notes (string with portion assumptions and uncertainty). Estimates must be editable. Do not claim exact nutrition."
    }
  ],
  "native": {
    "root": {
      "id": "root",
      "type": "stack",
      "props": {
        "gap": 20
      },
      "children": [
        {
          "id": "intro",
          "type": "stack",
          "props": {},
          "children": [
            {
              "id": "eyebrow",
              "type": "text",
              "props": {
                "text": "MADE FOR YOUR EVERYDAY",
                "variant": "eyebrow"
              }
            },
            {
              "id": "heading",
              "type": "text",
              "props": {
                "text": "Make room for good food",
                "variant": "title"
              }
            },
            {
              "id": "description",
              "type": "text",
              "props": {
                "text": "Take a photo, get a helpful estimate, and edit anything. Photos and history save on this device, with encrypted copies when data backup is enabled.",
                "variant": "body"
              }
            }
          ]
        },
        {
          "id": "calories",
          "type": "metric",
          "props": {
            "label": "Logged calories",
            "tableId": "wellness.meals",
            "field": "calories",
            "operation": "sum",
            "suffix": " kcal"
          }
        },
        {
          "id": "capture",
          "type": "aiPhoto",
          "props": {
            "title": "What’s on your plate?",
            "tableId": "wellness.meals",
            "requestId": "meal-analysis",
            "resultFields": [
              {
                "name": "title",
                "label": "Meal",
                "type": "string"
              },
              {
                "name": "calories",
                "label": "Calories (estimate)",
                "type": "number"
              },
              {
                "name": "protein",
                "label": "Protein in grams (estimate)",
                "type": "number"
              },
              {
                "name": "notes",
                "label": "Notes & assumptions",
                "type": "string"
              }
            ]
          }
        },
        {
          "id": "history",
          "type": "list",
          "props": {
            "title": "Your food diary",
            "tableId": "wellness.meals",
            "titleField": "title",
            "detailField": "notes"
          }
        }
      ]
    }
  },
  "assets": [],
  "releaseNotes": "First edition. Sample content is labeled; your edits stay on this device."
}
