{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thesoftwarelens.com/saacip/0.1/schemas/capability-manifest.schema.json",
  "$comment": "SaaCIP 0.1 (https://thesoftwarelens.com/saacip/). Licensed under the Apache License 2.0.",
  "title": "SaaCIP 0.1 capability manifest",
  "description": "What a hirer can read about a capability before hiring it (section 7.1). Usually written as YAML by people and exchanged as JSON.",
  "type": "object",
  "required": [
    "protocol",
    "id",
    "version",
    "profiles",
    "hire_kinds",
    "autonomy",
    "declared_actions",
    "data"
  ],
  "properties": {
    "protocol": {
      "$ref": "common.schema.json#/$defs/protocol"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,119}$",
      "description": "A stable identifier for the capability, chosen by its provider."
    },
    "name": {
      "type": "string"
    },
    "version": {
      "type": "string"
    },
    "provider": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "profiles": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/profile"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "hire_kinds": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/hireKind"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "autonomy": {
      "type": "object",
      "required": [
        "default",
        "max"
      ],
      "properties": {
        "default": {
          "$ref": "common.schema.json#/$defs/autonomyLevel"
        },
        "max": {
          "$ref": "common.schema.json#/$defs/autonomyLevel"
        }
      }
    },
    "work_items": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "description": "What the capability calls its work items, for example incident."
        }
      }
    },
    "declared_actions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "reversible"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "reversible": {
            "type": "boolean"
          },
          "auto_allowed": {
            "type": "boolean"
          }
        }
      },
      "description": "A summary of the declared actions file (section 7.6): enough for a hirer to see what the capability could ever do."
    },
    "data": {
      "type": "object",
      "required": [
        "stays",
        "leaves_by_default"
      ],
      "properties": {
        "stays": {
          "type": "string"
        },
        "leaves_by_default": {
          "type": "string"
        }
      }
    },
    "connectors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Resident profile: the connector kinds the capability can use."
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext"
    },
    "crit": {
      "$ref": "common.schema.json#/$defs/crit"
    }
  }
}
