{
    "description": "Schema for an array of recovery scenarios",
    "minProperties": 1,
    "patternProperties": {
        "^iglu:": {
            "items": {
                "properties": {
                    "conditions": {
                        "description": "Conditions required to apply steps for specific Bad Row type",
                        "items": {
                            "additionalProperties": false,
                            "properties": {
                                "from": {
                                    "description": "Source type to cast from",
                                    "type": "string"
                                },
                                "match": {
                                    "description": "An expression applied when replacing field\u2019s values with new value",
                                    "type": "string"
                                },
                                "op": {
                                    "description": "Transformation operation to perform",
                                    "enum": [
                                        "Cast",
                                        "Remove",
                                        "Replace",
                                        "Test"
                                    ],
                                    "type": "string"
                                },
                                "path": {
                                    "description": "JSON Path to object",
                                    "type": "string"
                                },
                                "to": {
                                    "description": "Target type to cast to",
                                    "type": "string"
                                },
                                "value": {
                                    "description": "A value to match against",
                                    "oneOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare against static value",
                                            "properties": {
                                                "value": {
                                                    "type": [
                                                        "array",
                                                        "number",
                                                        "object",
                                                        "string"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "value"
                                            ],
                                            "type": "object"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare against regular expression",
                                            "properties": {
                                                "regex": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "regex"
                                            ],
                                            "type": "object"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare size",
                                            "properties": {
                                                "size": {
                                                    "oneOf": [
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "eq": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "eq"
                                                            ]
                                                        },
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "lt": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "lt"
                                                            ]
                                                        },
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "gt": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "gt"
                                                            ]
                                                        }
                                                    ],
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            },
                            "required": [
                                "op",
                                "path"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "name": {
                        "description": "A slug name for recovery flow",
                        "minLength": 1,
                        "pattern": "^(([a-zA-Z0-9]+)(-?))+$",
                        "type": "string"
                    },
                    "steps": {
                        "description": "Steps to be applied for specific Bad Row type",
                        "items": {
                            "additionalProperties": false,
                            "properties": {
                                "from": {
                                    "description": "Source type to cast from",
                                    "type": "string"
                                },
                                "match": {
                                    "description": "An expression applied when replacing field\u2019s values with new value",
                                    "type": "string"
                                },
                                "op": {
                                    "description": "Transformation operation to perform",
                                    "enum": [
                                        "Cast",
                                        "Remove",
                                        "Replace",
                                        "Test"
                                    ],
                                    "type": "string"
                                },
                                "path": {
                                    "description": "JSON Path to object",
                                    "type": "string"
                                },
                                "to": {
                                    "description": "Target type to cast to",
                                    "type": "string"
                                },
                                "value": {
                                    "description": "A value to match against",
                                    "oneOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare against static value",
                                            "properties": {
                                                "value": {
                                                    "type": [
                                                        "array",
                                                        "number",
                                                        "object",
                                                        "string"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "value"
                                            ],
                                            "type": "object"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare against regular expression",
                                            "properties": {
                                                "regex": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "regex"
                                            ],
                                            "type": "object"
                                        },
                                        {
                                            "additionalProperties": false,
                                            "description": "Compare size",
                                            "properties": {
                                                "size": {
                                                    "oneOf": [
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "eq": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "eq"
                                                            ]
                                                        },
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "lt": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "lt"
                                                            ]
                                                        },
                                                        {
                                                            "additionalProperties": false,
                                                            "properties": {
                                                                "gt": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "gt"
                                                            ]
                                                        }
                                                    ],
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            },
                            "required": [
                                "op",
                                "path"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    }
                },
                "required": [
                    "name",
                    "conditions",
                    "steps"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "self": {
        "format": "jsonschema",
        "name": "recoveries",
        "vendor": "com.snowplowanalytics.snowplow",
        "version": "3-0-0"
    },
    "type": "object"
}