{
  "$defs": {
    "MetricDirection": {
      "enum": [
        "higher_is_better",
        "lower_is_better"
      ],
      "title": "MetricDirection",
      "type": "string"
    },
    "MetricName": {
      "pattern": "^[a-z][a-z0-9_]{0,62}$",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "description": "A metric that must not get worse than the baseline by more than ``margin``.\n\n``relative`` reads ``margin`` as a share of the baseline value, so 0.2 allows the candidate 20 % worse.",
  "properties": {
    "direction": {
      "anyOf": [
        {
          "$ref": "#/$defs/MetricDirection"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "margin": {
      "minimum": 0,
      "title": "Margin",
      "type": "number"
    },
    "metric": {
      "$ref": "#/$defs/MetricName"
    },
    "relative": {
      "default": false,
      "title": "Relative",
      "type": "boolean"
    }
  },
  "required": [
    "metric",
    "margin"
  ],
  "title": "Guardrail",
  "type": "object"
}
