{
    "additionalProperties": false,
    "properties": {
        "applicationContext": {
            "additionalProperties": false,
            "properties": {
                "name": {
                    "type": "string"
                },
                "version": {
                    "pattern": "\\d+\\.\\d+\\.\\d+-?.*",
                    "type": "string"
                }
            },
            "required": [
                "version",
                "name"
            ],
            "type": "object"
        },
        "factfile": {
            "maxLength": 1000000,
            "type": "string"
        },
        "jobName": {
            "type": "string"
        },
        "jobReference": {
            "type": "string"
        },
        "jobTransition": {
            "additionalProperties": false,
            "properties": {
                "currentState": {
                    "enum": [
                        "RUNNING",
                        "WAITING",
                        "SUCCEEDED",
                        "FAILED"
                    ]
                },
                "previousState": {
                    "enum": [
                        "RUNNING",
                        "WAITING",
                        "SUCCEEDED",
                        "FAILED",
                        null
                    ]
                }
            },
            "required": [
                "previousState",
                "currentState"
            ],
            "type": "object"
        },
        "runDuration": {
            "type": "string"
        },
        "runReference": {
            "type": "string"
        },
        "runState": {
            "enum": [
                "RUNNING",
                "WAITING",
                "SUCCEEDED",
                "FAILED"
            ]
        },
        "startTime": {
            "_format": "date-time",
            "type": "string"
        },
        "tags": {
            "patternProperties": {
                ".*": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "taskStates": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "duration": {
                        "type": "string"
                    },
                    "errorMessage": {
                        "type": "string"
                    },
                    "returnCode": {
                        "maximum": 32767,
                        "minimum": -32767,
                        "type": "integer"
                    },
                    "started": {
                        "_format": "date-time",
                        "type": "string"
                    },
                    "state": {
                        "enum": [
                            "RUNNING",
                            "WAITING",
                            "SUCCEEDED",
                            "SUCCEEDED_NO_OP",
                            "FAILED",
                            "SKIPPED"
                        ]
                    },
                    "stderr": {
                        "type": "string"
                    },
                    "stdout": {
                        "type": "string"
                    },
                    "taskName": {
                        "type": "string"
                    }
                },
                "required": [
                    "taskName",
                    "state"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "required": [
        "jobName",
        "jobReference",
        "runReference",
        "runState",
        "factfile",
        "applicationContext",
        "startTime",
        "runDuration",
        "taskStates",
        "tags"
    ],
    "self": {
        "format": "jsonschema",
        "name": "job_update",
        "vendor": "com.snowplowanalytics.factotum",
        "version": "1-0-0"
    },
    "type": "object"
}