{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ember.local/schemas/applet-manifest-v1.json",
  "title": "Ember applet manifest v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["manifestVersion", "id", "name", "version", "entry", "permissions"],
  "properties": {
    "$schema": { "type": "string" },
    "manifestVersion": { "const": 1 },
    "id": { "type": "string", "maxLength": 100, "pattern": "^[a-z][a-z0-9]*(\\.[a-z][a-z0-9-]*)+$" },
    "name": { "type": "string", "minLength": 1, "maxLength": 40 },
    "description": { "type": "string", "maxLength": 180, "default": "" },
    "version": { "type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?$" },
    "entry": { "type": "string", "pattern": "^[^/\\\\].*\\.html$" },
    "accent": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$", "default": "#6f7667" },
    "icon": { "enum": ["applet", "notes", "focus", "weather", "calendar"], "default": "applet" },
    "permissions": { "type": "array", "uniqueItems": true, "items": { "enum": ["storage"] } },
    "settings": { "type": "array", "maxItems": 24, "items": { "$ref": "#/$defs/setting" } },
    "window": { "$ref": "#/$defs/window" }
  },
  "$defs": {
    "setting": {
      "type": "object", "additionalProperties": false,
      "required": ["key", "label", "type", "default"],
      "properties": {
        "key": { "type": "string", "pattern": "^[a-z0-9-]{1,64}$" },
        "label": { "type": "string", "minLength": 1, "maxLength": 60 },
        "description": { "type": "string", "maxLength": 160, "default": "" },
        "type": { "enum": ["boolean", "string", "select"] },
        "options": { "type": "array", "minItems": 1, "maxItems": 12, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 80 } },
        "default": {}
      }
    },
    "window": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "width": { "type": "number", "minimum": 320, "maximum": 1920, "default": 900 },
        "height": { "type": "number", "minimum": 240, "maximum": 1200, "default": 650 },
        "minWidth": { "type": "number", "minimum": 240, "default": 480 },
        "minHeight": { "type": "number", "minimum": 180, "default": 360 }
      }
    }
  }
}
