{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/fleet-request.schema.json",
  "title": "Fleet command",
  "type": "object",
  "required": [
    "selector",
    "operation"
  ],
  "properties": {
    "selector": {
      "type": "object",
      "minProperties": 1,
      "properties": {
        "systems": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "profile": {
          "type": "string"
        },
        "status": {
          "type": "array",
          "items": {
            "$ref": "common.schema.json#/$defs/status"
          }
        }
      }
    },
    "operation": {
      "type": "object",
      "required": [
        "method",
        "path"
      ],
      "properties": {
        "method": {
          "enum": [
            "GET",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ]
        },
        "path": {
          "type": "string",
          "pattern": "^/"
        },
        "body": {}
      }
    },
    "physical": {
      "description": "True if the operation is physical on the systems it reaches. The person approves it as physical; a system refuses a fleet approval for a physical Action that does not say so (API Standard 13.3).",
      "type": "boolean",
      "default": false
    },
    "rollout": {
      "type": "object",
      "properties": {
        "batchSize": {
          "type": "integer",
          "minimum": 1
        },
        "maxFailures": {
          "type": "integer",
          "minimum": 0
        },
        "pauseSec": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
