{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.application-definition.v1.schema.json",
  "title": "cApp application definition v1",
  "type": "object",
  "required": [
    "protocol",
    "appId"
  ],
  "properties": {
    "protocol": {
      "const": "capp.application-definition.v1"
    },
    "appId": {
      "type": "string",
      "minLength": 1
    },
    "requires": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "optional": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "routes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "path"
        ],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/"
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "capability": {
            "type": "string"
          },
          "risk": {
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ]
          },
          "execution": {
            "enum": [
              "auto",
              "local-preferred",
              "local-only",
              "remote-preferred",
              "remote-only"
            ]
          }
        },
        "additionalProperties": true
      }
    },
    "data": {
      "type": "object"
    },
    "metadata": {
      "type": "object"
    }
  },
  "additionalProperties": true
}
