{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "errorStrategy": {
            "type": "string",
            "title": "Error strategy",
            "description": "Strategy applied to handle rate-limiting internal errors.",
            "default": "FALLBACK_PASS_TROUGH",
            "enum": ["BLOCK_ON_INTERNAL_ERROR", "FALLBACK_PASS_TROUGH"],
            "gioConfig": {
                "enumLabelMap": {
                    "BLOCK_ON_INTERNAL_ERROR": "Block queries in case of internal failure",
                    "FALLBACK_PASS_TROUGH": "Accept queries in case of internal failure (previous default behavior)"
                }
            }
        },
        "async": {
            "type": "boolean",
            "default": false,
            "title": "Non-strict mode (async)",
            "description": "By activating this option, spike limit is applied in an asynchronous way meaning that the distributed counter value is not strict (backend can receive more queries than configured)."
        },
        "addHeaders": {
            "type": "boolean",
            "default": false,
            "title": "Add response headers",
            "description": "Add X-Spike-Arrest-Limit, X-Spike-Arrest-Remaining and X-Spike-Arrest-Reset headers in HTTP response"
        },
        "spike": {
            "type": "object",
            "title": "Apply spike limit",
            "properties": {
                "key": {
                    "type": "string",
                    "default": "",
                    "title": "Key",
                    "description": "Key to identify a consumer against whom the quota will be applied. Leave it empty to use the default behavior. Supports EL.",
                    "x-schema-form": {
                        "expression-language": true
                    }
                },
                "useKeyOnly": {
                    "type": "boolean",
                    "default": false,
                    "title": "Use key only",
                    "description": "Only uses the custom key to identify the consumer, regardless of the subscription and plan."
                },
                "limit": {
                    "type": "integer",
                    "title": "Max requests (static)",
                    "description": "Static limit on the number of requests that can be sent (this limit is used if the value > 0).",
                    "minimum": 0
                },
                "dynamicLimit": {
                    "type": "string",
                    "title": "Max requests (dynamic)",
                    "description": "Dynamic limit on the number of requests that can be sent (this limit is used if static limit = 0). The dynamic value is based on EL expressions.",
                    "x-schema-form": {
                        "expression-language": true
                    }
                },
                "periodTime": {
                    "type": "integer",
                    "title": "Static time duration",
                    "description": "If defined, will be used instead of 'Dynamic time duration'.",
                    "minimum": 0
                },
                "periodTimeUnit": {
                    "type": "string",
                    "title": "Static time unit",
                    "default": "SECONDS",
                    "enum": ["SECONDS", "MINUTES"]
                },
                "dynamicPeriodTime": {
                    "type": "string",
                    "title": "Dynamic time duration (Supports EL)",
                    "description": "The 'Static time duration' must be empty to use the dynamic period. The time unit is set to SECONDS by default.",
                    "x-schema-form": {
                        "expression-language": true
                    },
                    "gioConfig": {
                        "el": true
                    }
                }
            }
        }
    },
    "required": ["spike"]
}
