{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://textxt.com/mini-apps/schema/manifest-v1.json",
  "title": "Textxt Mini App Manifest",
  "description": "Public manifest contract for a Textxt Mini App release.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "manifestVersion",
    "appId",
    "name",
    "description",
    "startUrl",
    "allowedOrigins",
    "permissions",
    "bridgeVersion",
    "visibility",
    "tags",
    "version",
    "privacyPolicyUrl",
    "supportUrl"
  ],
  "properties": {
    "manifestVersion": {
      "type": "integer",
      "const": 1
    },
    "appId": {
      "type": "string",
      "minLength": 2,
      "maxLength": 64,
      "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$"
    },
    "name": {
      "type": "string",
      "minLength": 2,
      "maxLength": 60
    },
    "description": {
      "type": "string",
      "minLength": 10,
      "maxLength": 500
    },
    "iconUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "startUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "allowedOrigins": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "format": "uri",
        "maxLength": 255
      }
    },
    "permissions": {
      "type": "array",
      "maxItems": 10,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "readContext",
          "sendMessage",
          "setDraft",
          "openTopic",
          "uploadFile",
          "boards",
          "polls"
        ]
      }
    },
    "capabilities": {
      "type": "array",
      "maxItems": 4,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": ["message.text"]
      }
    },
    "bridgeVersion": {
      "type": "string",
      "const": "1.0"
    },
    "visibility": {
      "type": "string",
      "enum": ["private", "shared", "public"]
    },
    "tags": {
      "type": "array",
      "maxItems": 12,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 32,
        "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
      }
    },
    "version": {
      "type": "string",
      "maxLength": 64,
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
    },
    "privacyPolicyUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "supportUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "releaseNotes": {
      "type": "string",
      "maxLength": 1000
    }
  }
}
