{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "JobConfig": {
            "additionalProperties": false,
            "description": "The configuration used to find and load the job.",
            "properties": {
                "package": {
                    "description": "The ID of the package that contains the job.",
                    "type": "string"
                },
                "type": {
                    "description": "The short or full name of the type of job.",
                    "type": "string"
                },
                "version": {
                    "description": "The version of the package that contains the job.",
                    "type": "string"
                }
            },
            "required": [
                "type"
            ],
            "type": "object"
        },
        "ResultsLevel": {
            "enum": [
                0,
                1,
                2
            ],
            "type": "number"
        }
    },
    "properties": {
        "execution": {
            "additionalProperties": false,
            "description": "The config that defines how the job will be executed.",
            "properties": {
                "handleExceptions": {
                    "description": "Whether or not to handle exceptions.",
                    "type": "boolean"
                },
                "itemFailureCountToStopJob": {
                    "description": "The number of items which must fail before the job is stopped, ending in a failure state.",
                    "minimum": 1,
                    "type": "integer"
                },
                "itemFailureRetryCount": {
                    "description": "The number of times, after the first attempt, to reprocess an item when an error occurs or a failed result is returned.",
                    "minimum": 1,
                    "type": "integer"
                },
                "parallelTaskCount": {
                    "description": "The number of tasks or threads created to process each item in the job.",
                    "minimum": 1,
                    "type": "integer"
                }
            },
            "type": "object"
        },
        "job": {
            "anyOf": [
                {
                    "$ref": "#/definitions/JobConfig"
                },
                {
                    "type": "string"
                }
            ],
            "description": "Identifies the job that will run when executed."
        },
        "results": {
            "properties": {
                "filePath": {
                    "description": "The file path to write the results to.",
                    "type": "string"
                },
                "includeConfigInFile": {
                    "description": "Include the config in the results when results are saved to a file.",
                    "type": "boolean"
                },
                "level": {
                    "$ref": "#/definitions/ResultsLevel",
                    "description": "The severity level of results to write to the file, console, or API."
                },
                "toConsole": {
                    "description": "When true, writes the results to the console when the job is complete.",
                    "type": "boolean"
                }
            },
            "required": [
                "level"
            ],
            "type": "object"
        },
        "runlyApi": {
            "properties": {
                "cluster": {
                    "description": "The name of the cluster that the run is assigned to.",
                    "type": "string"
                },
                "environmentId": {
                    "description": "The environment that the run is queued or executing in.",
                    "type": "string"
                },
                "instanceId": {
                    "description": "The ID of the instance assigned by the API.",
                    "type": "string"
                },
                "node": {
                    "description": "The name of the cluster that the run is assigned to.",
                    "type": "string"
                },
                "organizationId": {
                    "description": "The org that the run is queued or executing in.",
                    "type": "string"
                },
                "token": {
                    "description": "The auth token used to grant the job access to the API.",
                    "type": "string"
                },
                "uri": {
                    "description": "The URI of the Runly API, https://api.runly.io/ by default.",
                    "type": "string"
                }
            },
            "type": "object"
        }
    },
    "required": [
        "job"
    ],
    "type": "object"
}

