{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/execution/v1/schema.json",
  "title": "rtemis ExecutionConfig",
  "description": "Language-independent config for rtemis execution: sequential, parallel, or distributed. Mirrors the `ExecutionConfig` object / `setup_ExecutionConfig` arguments.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://schema.rtemis.org/execution/v1/schema.json",
      "description": "JSON Schema URI for this config instance."
    },
    "backend": {
      "type": "string",
      "enum": ["future", "mirai", "none"],
      "default": "none",
      "description": "Execution backend."
    },
    "n_workers": {
      "type": "integer",
      "minimum": 1,
      "default": 1,
      "description": "Number of parallel workers (used when backend is 'future' or 'mirai')."
    },
    "future_plan": {
      "type": ["string", "null"],
      "default": null,
      "description": "Future plan to use when backend is 'future'."
    },
    "on_error": {
      "type": "string",
      "enum": ["continue", "stop", "stop_outer"],
      "default": "continue",
      "description": "Failure policy."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "backend": {
            "const": "future"
          }
        },
        "required": ["backend"]
      },
      "then": {
        "required": ["future_plan"]
      }
    },
    {
      "if": {
        "properties": {
          "backend": {
            "const": "none"
          }
        },
        "required": ["backend"]
      },
      "then": {
        "properties": {
          "n_workers": {
            "const": 1
          }
        }
      }
    }
  ]
}
