{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thesoftwarelens.com/saacip/0.1/schemas/declared-actions.schema.json",
  "$comment": "SaaCIP 0.1 (https://thesoftwarelens.com/saacip/). Licensed under the Apache License 2.0.",
  "title": "SaaCIP 0.1 declared actions file",
  "description": "The only actions a capability may ever take, written and approved by a person before the hire (section 7.6). The core fields are below; the Resident profile adds match, services and command (Resident profile, section 5).",
  "type": "object",
  "required": [
    "actions"
  ],
  "properties": {
    "actions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "reversible"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "title": {
            "type": "string"
          },
          "reversible": {
            "type": "boolean",
            "description": "true only when the action can be undone or safely repeated. Irreversible actions always wait for approval."
          },
          "auto_allowed": {
            "type": "boolean",
            "default": false,
            "description": "May run without a fresh approval at autonomy level 3."
          },
          "max_per_day": {
            "type": "integer",
            "minimum": 0,
            "description": "The most times the action may run by itself in one UTC calendar day. Absent means no automatic runs."
          },
          "match": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Resident profile: substrings a finding must contain for this action to be considered."
          },
          "services": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Resident profile: the only services the action may target."
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "description": "Resident profile: an argument list run without a shell. The only placeholder is {service}, filled from services."
          }
        }
      }
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext"
    },
    "crit": {
      "$ref": "common.schema.json#/$defs/crit"
    }
  }
}
