{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "notifications_chain": {
      "type": "object",
      "properties": {
        "on_start": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        },
        "on_end": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        },
        "on_fail": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        },
        "on_retry": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        },
        "on_waiting_dependencies": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "type": "object",
  "required": ["id", "name", "processes"],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "namespace": {
      "type": "string"
    },
    "execId": {
      "type": "string"
    },
    "queue": {
      "type": "string"
    },
    "priority": {
      "type": "number"
    },
    "input": {
      "type": ["array", "string"]
    },
    "custom_values": {
      "type": "object"
    },
    "retries": {
      "type": "number"
    },
    "retry_delay": {
      "type": ["number", "string"]
    },
    "iterable": {
      "type": "string",
      "enum": ["serie", "parallel"]
    },
    "ignore_on_concurrence": {
      "type": "boolean"
    },
    "abort_iteration_serie_on_error": {
      "type": "boolean"
    },
    "triggers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "calendars": {
            "type": "object",
            "properties": {
              "allow": {
                "type": "string"
              },
              "disallow": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "depends_chains": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "chain_id": {
              "type": "string"
            },
            "process_id": {
              "type": "string"
            }
          }
        },
        {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "chain_id": {
                    "type": "string"
                  },
                  "process_id": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "string"
              }
            ]
          }
        }
      ]
    },
    "notifications": { "$ref": "#/definitions/notifications_chain" },
    "defaults_processes": {
      "type": "object",
      "properties": {
        "notifications": {
          "$ref": "processSchema#/definitions/notifications_process"
        },
        "chain_action_on_fail": {
          "$ref": "processSchema#/definitions/chain_action_on_fail_process"
        },
        "ignore_in_final_chain_status": {
          "type": "boolean"
        },
        "output": { "$ref": "processSchema#/definitions/output_process" }
      }
    },
    "processes": {
      "$ref": "processSchema"
    },
    "meta": {
      "type": "object",
      "properties": {
        "author": {
          "type": "string"
        },
        "team": {
          "type": "string"
        },
        "criticality": {
          "type": "string",
          "enum": ["low", "medium", "high"]
        },
        "contacts": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["name"],
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            }
          }
        },
        "fail_comments": {
          "type": "string"
        },
        "relaunchable": {
          "type": "boolean"
        },
        "input_keys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "max_expected_time": {
          "type": "string"
        }
      }
    },
    "runnerty.io": {
      "type": "object",
      "properties": {
        "remoteControl": {
          "type": "boolean"
        },
        "sync": {
          "type": "object",
          "properties": {
            "events": {
              "type": "boolean"
            },
            "chain": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }
}
