{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/emporix/json-schema/emporix-health-settings-schema.json",
  "title": "Tenant health thresholds",
  "description": "The tenant-wide thresholds, together with the built-in defaults they fall back to.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-analytics-api-openapi.yml#/components/schemas/HealthSettings",
  "type": "object",
  "properties": {
    "thresholds": {
      "$ref": "#/$defs/HealthThresholds"
    },
    "builtInDefaults": {
      "$ref": "#/$defs/HealthThresholds"
    }
  },
  "$defs": {
    "HealthThresholds": {
      "title": "Health thresholds",
      "type": "object",
      "description": "The limits that decide whether a stream is reported as `GREEN`, `AMBER`, or `RED`. Each field is optional and resolves independently. An unset field falls back through the hierarchy, from the most specific level to the least specific: stream, configuration, tenant, then the built-in default.",
      "properties": {
        "failureRatioAmber": {
          "type": "number",
          "format": "double",
          "description": "The share of failed records (0..1) at or above which the stream is `AMBER`."
        },
        "failureRatioRed": {
          "type": "number",
          "format": "double",
          "description": "The share of failed records (0..1) at or above which the stream is `RED`."
        },
        "staleAmberHours": {
          "type": "integer",
          "description": "The age threshold, in hours, for the stream's newest data. The stream is `AMBER` when the data's age reaches or exceeds this threshold."
        },
        "staleRedHours": {
          "type": "integer",
          "description": "The age threshold, in hours, for the stream's newest data. The stream is `RED` when the data's age reaches or exceeds this threshold."
        },
        "failedRunIsRed": {
          "type": "boolean",
          "description": "Whether a failed most-recent run makes the stream `RED` regardless of the other limits."
        }
      }
    }
  }
}