{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "title": "JobManifest",
    "additionalProperties": false,
    "properties": {
        "$schema": {
            "type": "string",
            "description": "the manifest schema version"
        },
        "name": {
            "type": "string",
            "description": "Name of the job",
            "$ref": "#/definitions/name-pattern"
        },
        "displayName": {
            "type": "string",
            "description": "Display name of the job"
        },
        "description": {
            "type": "string",
            "description": "Description of the job"
        },
        "mainFunction": {
            "type": "string",
            "description": "Name of the main function to be executed at the root of the access url"
        },
        "version": {
            "type": "string",
            "description": "Semver version number",
            "minLength": 5,
            "maxLength": 14,
            "pattern": "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$"
        },
        "timeout": {
            "type": "number",
            "description": "Timeout in seconds before a job is stopped (min 10min, max 8h)",
            "minimum": 600,
            "maximum": 28800
        },
        "concurrency": {
            "type": "number",
            "description": "The number of these jobs that can be run at once",
            "minimum": 1
        },
        "image": {
            "type": "string",
            "description": "Optional runtime image the job should execute against (e.g. \"node:20\", \"node:24\"). When omitted, job runner will default to the recommended runtime image."
        },
        "autoRetry": {
            "type": "boolean",
            "description": "Whether failed job code executions should be retried automatically. When omitted, job runner will not retry failed job code executions.",
            "default": false
        },
        "functions": {
            "type": "array",
            "minItems": 0,
            "items": {
                "title": "JobFunction",
                "description": "Job function definition, this object provides the runtime with input validation and what to execute",
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "$ref": "#/definitions/name-pattern",
                        "description": "Function name"
                    },
                    "entry": {
                        "type": "string",
                        "description": "File path to the javascript file to execute. The file path must be relative to the manifest file and cannot be in a folder above the manifest file."
                    },
                    "input": {
                        "$ref": "DxComponentInputSchema.json"
                    }
                },
                "required": ["name", "entry", "input"]
            }
        }
    },
    "required": [
        "name",
        "displayName",
        "description",
        "version",
        "functions",
        "$schema",
        "mainFunction",
        "concurrency",
        "timeout"
    ],
    "definitions": {
        "name-pattern": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_\\-]+$"
        }
    }
}
