{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "definitions": {
        "valuePath": {
            "title": "Value Path",
            "description": "JSON Path of where to find value to check in payload",
            "type": "string",
            "minLength": 1
        },
        "_changeTypeOthers": {
            "title": "Change Type",
            "enum": [
                "percent",
                "percentInc",
                "percentDec",
                "value",
                "valueInc",
                "valueDec"
            ]
        },
        "_changeTypeAny": {
            "title": "Change Type",
            "enum": [
                "any"
            ]
        },
        "changeThreshold": {
            "title": "Change Threshold",
            "description": "Amount of change required",
            "type": "number"
        },
        "prevValuePath": {
            "title": "Previous Value Path",
            "description": "JSON path of where to put the previous triggering value and time",
            "type": "string",
            "minLength": 1
        }
    },
    "oneOf": [
        {
            "properties": {
                "valuePath": {
                    "$ref": "#/definitions/valuePath"
                },
                "changeType": {
                    "$ref": "#/definitions/_changeTypeOthers"
                },
                "changeThreshold": {
                    "$ref": "#/definitions/changeThreshold"
                },
                "prevValuePath": {
                    "$ref": "#/definitions/prevValuePath"
                }
            },
            "required": [
                "valuePath",
                "changeType",
                "changeThreshold"
            ],
            "additionalProperties": false
        },
        {
            "properties": {
                "valuePath": {
                    "$ref": "#/definitions/valuePath"
                },
                "changeType": {
                    "$ref": "#/definitions/_changeTypeAny"
                },
                "prevValuePath": {
                    "$ref": "#/definitions/prevValuePath"
                }
            },
            "required": [
                "valuePath",
                "changeType"
            ],
            "additionalProperties": false
        }
    ]
}