{
  "id": "com.lattice.journal",
  "name": "Journal",
  "icon": "▤",
  "color": "#8b5a9f",
  "description": "Keep daily journal entries with mood and tags.",
  "requested_permissions": {
    "storage": [
      "sql"
    ],
    "network": {
      "allowlist": []
    },
    "events": {
      "entry-created": {
        "description": "A daily entry was created.",
        "schema": {
          "type": "object",
          "properties": {
            "entry_id": {
              "type": "string",
              "description": "Entry UUID.",
              "minLength": 1
            },
            "date": {
              "type": "string",
              "description": "Local entry date, YYYY-MM-DD; one entry per date.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "text": {
              "type": "string",
              "description": "Full entry text, possibly multiline.",
              "minLength": 1
            },
            "mood": {
              "type": "string",
              "description": "Self-reported mood.",
              "enum": [
                "very-low",
                "low",
                "neutral",
                "good",
                "great"
              ]
            },
            "tags": {
              "type": "array",
              "description": "Trimmed, case-sensitive tags; empty array means none.",
              "items": {
                "type": "string",
                "description": "Nonempty tag.",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "created_at": {
              "type": "string",
              "description": "Creation time, UTC ISO 8601 timestamp.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "updated_at": {
              "type": "string",
              "description": "Last-change time, UTC ISO 8601 timestamp.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            }
          },
          "required": [
            "entry_id",
            "date",
            "text",
            "mood",
            "tags",
            "created_at",
            "updated_at"
          ],
          "additionalProperties": false
        }
      },
      "entry-updated": {
        "description": "A daily entry was edited or appended to.",
        "schema": {
          "type": "object",
          "properties": {
            "entry_id": {
              "type": "string",
              "description": "Entry UUID.",
              "minLength": 1
            },
            "date": {
              "type": "string",
              "description": "Local entry date, YYYY-MM-DD; one entry per date.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "text": {
              "type": "string",
              "description": "Full entry text, possibly multiline.",
              "minLength": 1
            },
            "mood": {
              "type": "string",
              "description": "Self-reported mood.",
              "enum": [
                "very-low",
                "low",
                "neutral",
                "good",
                "great"
              ]
            },
            "tags": {
              "type": "array",
              "description": "Trimmed, case-sensitive tags; empty array means none.",
              "items": {
                "type": "string",
                "description": "Nonempty tag.",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "created_at": {
              "type": "string",
              "description": "Creation time, UTC ISO 8601 timestamp.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "updated_at": {
              "type": "string",
              "description": "Last-change time, UTC ISO 8601 timestamp.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            }
          },
          "required": [
            "entry_id",
            "date",
            "text",
            "mood",
            "tags",
            "created_at",
            "updated_at"
          ],
          "additionalProperties": false
        }
      }
    },
    "listeners": {
      "add-entry": {
        "description": "Append text with two newlines to the date’s entry, creating it if absent.",
        "schema": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "Nonblank text to append; surrounding whitespace is trimmed.",
              "minLength": 1
            },
            "date": {
              "type": "string",
              "description": "Local entry date, YYYY-MM-DD; omitted defaults to local today.",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "mood": {
              "type": "string",
              "description": "Mood; omitted preserves existing mood or defaults to neutral for new entries.",
              "enum": [
                "very-low",
                "low",
                "neutral",
                "good",
                "great"
              ]
            },
            "tags": {
              "type": "array",
              "description": "Trimmed, case-sensitive tags to union; omitted or empty preserves existing tags.",
              "items": {
                "type": "string",
                "description": "Nonempty tag.",
                "minLength": 1
              },
              "uniqueItems": true
            }
          },
          "required": [
            "text"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "source": {
    "assets": [
      "index.html",
      "app.js",
      "app.css",
      "ui.css",
      "emits.js",
      "listens.js"
    ]
  }
}