{
    "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",
                                    "pattern": "^(([a-zA-Z0-9]+)(\\.?))+$",
                                    "type": "string"
                                },
                                "to": {
                                    "description": "Target type to cast to",
                                    "type": "string"
                                },
                                "value": {
                                    "description": "A value to match against",
                                    "oneOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "description": "Compare against static value",
                                            "properties": {
                                                "value": {
                                                    "type": [
                                                        "array",
                                                        "number",
                                                        "object",
                                                        "string"
                                                    ]
                                                }
                                            },
                                            "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": [
                                                        {
                                                            "properties": {
                                                                "eq": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        },
                                                        {
                                                            "properties": {
                                                                "lt": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        },
                                                        {
                                                            "properties": {
                                                                "gt": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        }
                                                    ],
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            },
                            "required": [
                                "op",
                                "path",
                                "value"
                            ],
                            "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",
                                    "pattern": "^(([a-zA-Z0-9]+)(\\.?))+$",
                                    "type": "string"
                                },
                                "to": {
                                    "description": "Target type to cast to",
                                    "type": "string"
                                },
                                "value": {
                                    "description": "A value to match against",
                                    "oneOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "description": "Compare against static value",
                                            "properties": {
                                                "value": {
                                                    "type": [
                                                        "number",
                                                        "object",
                                                        "string"
                                                    ]
                                                }
                                            },
                                            "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": [
                                                        {
                                                            "properties": {
                                                                "eq": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        },
                                                        {
                                                            "properties": {
                                                                "lt": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        },
                                                        {
                                                            "properties": {
                                                                "gt": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        }
                                                    ],
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            },
                            "required": [
                                "op",
                                "path",
                                "value"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    }
                },
                "required": [
                    "name",
                    "conditions",
                    "steps"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "self": {
        "format": "jsonschema",
        "name": "recoveries",
        "vendor": "com.snowplowanalytics.snowplow",
        "version": "2-0-0"
    },
    "type": "object"
}