{
  "id": "com.lattice.pantry",
  "name": "Pantry",
  "icon": "🫙",
  "color": "#087f5b",
  "description": "Track products, stock lots and best-before dates in Grocy's stock model.",
  "provenance": "Grocy v4.5.0 OpenAPI, verified 2026-10-14: https://example.invalid/resource . Adopted Product id/name/description/location_id/qu_id_purchase/qu_id_stock/min_stock_amount/default_best_before_days/default_best_before_days_after_open/product_group_id; QuantityUnit id/name/name_plural/description; StockEntry id/product_id/location_id/amount/best_before_date/purchased_date/stock_id/price/open/opened_date/note. Tables follow the named API schemas. Numeric fields use OpenAPI schema types (some examples contain numeric strings); open stays integer. Quantity units are product-specific, not assumed to be pieces. Stable stock_id is distinct from numeric id. Local creation defaults and event/listener names are fixture conventions.",
  "requested_permissions": {
    "storage": [
      "sql"
    ],
    "network": {
      "allowlist": []
    },
    "events": {
      "product-added": {
        "description": "A product was added.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Product ID."
            },
            "name": {
              "type": "string",
              "description": "Product name."
            },
            "description": {
              "type": [
                "string",
                "null"
              ],
              "description": "Product description; null means unspecified."
            },
            "location_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Storage location ID; null means unspecified."
            },
            "qu_id_purchase": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Purchase quantity-unit ID; null means unspecified."
            },
            "qu_id_stock": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Stock quantity-unit ID; defines stock amount units; null means unspecified."
            },
            "min_stock_amount": {
              "type": "number",
              "description": "Minimum desired quantity in stock units.",
              "minimum": 0
            },
            "default_best_before_days": {
              "type": "integer",
              "description": "Shelf life in days; 0 means unspecified.",
              "minimum": 0
            },
            "default_best_before_days_after_open": {
              "type": "integer",
              "description": "Shelf life after opening in days; 0 means unspecified.",
              "minimum": 0
            },
            "product_group_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Product group ID; null means unspecified."
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        }
      },
      "stock-added": {
        "description": "A stock lot was added.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Stock-entry ID."
            },
            "product_id": {
              "type": "integer",
              "description": "Product ID."
            },
            "location_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Storage location ID; null means unspecified."
            },
            "amount": {
              "type": "number",
              "description": "Positive quantity in product stock units; may be fractional.",
              "exclusiveMinimum": 0
            },
            "best_before_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Best-before date, local YYYY-MM-DD; null means unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "purchased_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Purchase date, local YYYY-MM-DD; null means unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "stock_id": {
              "type": "string",
              "description": "Stable stock-lot identifier."
            },
            "price": {
              "type": [
                "number",
                "null"
              ],
              "description": "Purchase price in configured Grocy currency; null means unspecified."
            },
            "open": {
              "type": "integer",
              "description": "Opening flag: 0=unopened, 1=opened.",
              "enum": [
                0,
                1
              ]
            },
            "opened_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Opening date, local YYYY-MM-DD; null means unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "note": {
              "type": [
                "string",
                "null"
              ],
              "description": "Stock-lot note; null means unspecified."
            }
          },
          "required": [
            "id",
            "product_id",
            "amount",
            "stock_id",
            "open"
          ],
          "additionalProperties": false
        }
      },
      "stock-consumed": {
        "description": "A quantity was consumed from a stock lot.",
        "schema": {
          "type": "object",
          "properties": {
            "product_id": {
              "type": "integer",
              "description": "Product ID."
            },
            "stock_id": {
              "type": "string",
              "description": "Stable stock-lot identifier."
            },
            "amount": {
              "type": "number",
              "description": "Positive consumed quantity in product stock units.",
              "exclusiveMinimum": 0
            },
            "note": {
              "type": [
                "string",
                "null"
              ],
              "description": "Stock-lot note; null means unspecified."
            }
          },
          "required": [
            "product_id",
            "stock_id",
            "amount"
          ],
          "additionalProperties": false
        }
      },
      "stock-opened": {
        "description": "A stock lot was opened.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Stock-entry ID."
            },
            "product_id": {
              "type": "integer",
              "description": "Product ID."
            },
            "stock_id": {
              "type": "string",
              "description": "Stable stock-lot identifier."
            },
            "opened_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Opening date, local YYYY-MM-DD; null means unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "open": {
              "type": "integer",
              "description": "Opening flag: 0=unopened, 1=opened.",
              "enum": [
                0,
                1
              ],
              "const": 1
            }
          },
          "required": [
            "product_id",
            "stock_id",
            "open"
          ],
          "additionalProperties": false
        }
      }
    },
    "listeners": {
      "add-product": {
        "description": "Create a pantry product.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Product ID; generated when omitted."
            },
            "name": {
              "type": "string",
              "description": "Product name."
            },
            "description": {
              "type": [
                "string",
                "null"
              ],
              "description": "Product description; omitted or null means unspecified."
            },
            "location_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Storage location ID; omitted or null means unspecified."
            },
            "qu_id_purchase": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Purchase quantity-unit ID; omitted or null means unspecified."
            },
            "qu_id_stock": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Stock quantity-unit ID; defines stock amount units; omitted or null means unspecified."
            },
            "min_stock_amount": {
              "type": "number",
              "description": "Minimum desired quantity in stock units; omitted defaults to 0.",
              "minimum": 0
            },
            "default_best_before_days": {
              "type": "integer",
              "description": "Shelf life in days; omitted or 0 means unspecified.",
              "minimum": 0
            },
            "default_best_before_days_after_open": {
              "type": "integer",
              "description": "Shelf life after opening in days; omitted or 0 means unspecified.",
              "minimum": 0
            },
            "product_group_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Product group ID; omitted or null means unspecified."
            }
          },
          "required": [
            "name"
          ],
          "additionalProperties": false
        }
      },
      "add-stock": {
        "description": "Add a stock lot for an existing product.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Stock-entry ID; generated when omitted."
            },
            "product_id": {
              "type": "integer",
              "description": "Product ID."
            },
            "location_id": {
              "type": [
                "integer",
                "null"
              ],
              "description": "Storage location ID; omitted uses product default; null means unspecified."
            },
            "amount": {
              "type": "number",
              "description": "Positive quantity in product stock units; may be fractional.",
              "exclusiveMinimum": 0
            },
            "best_before_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Local YYYY-MM-DD; omitted derives from product shelf life when set; null means unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "purchased_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Purchase date, local YYYY-MM-DD; omitted defaults to local today; null means unknown.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "stock_id": {
              "type": "string",
              "description": "Stable stock-lot identifier; generated when omitted."
            },
            "price": {
              "type": [
                "number",
                "null"
              ],
              "description": "Purchase price in configured Grocy currency; omitted or null means unspecified."
            },
            "open": {
              "type": "integer",
              "description": "Opening flag: 0=unopened, 1=opened; omitted defaults to 0.",
              "enum": [
                0,
                1
              ]
            },
            "opened_date": {
              "type": [
                "string",
                "null"
              ],
              "description": "Opening date, local YYYY-MM-DD; omitted/null defaults to today when opened, otherwise unspecified.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "note": {
              "type": [
                "string",
                "null"
              ],
              "description": "Stock-lot note; omitted or null means unspecified."
            }
          },
          "required": [
            "product_id",
            "amount"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "x-effects": {
    "add-product": {
      "table": "products",
      "emits": "product-added"
    },
    "add-stock": {
      "table": "stock_entries",
      "emits": "stock-added"
    }
  },
  "source": {
    "assets": [
      "index.html",
      "app.js",
      "app.css",
      "ui.css",
      "emits.js",
      "listens.js"
    ]
  }
}