{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-alert-rule-schema.json",
  "title": "AlertRule",
  "description": "An alert rule as the API returns it. Internal join keys, and who else asked for in-app alerts, are left out.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-notifications-api-openapi.yml#/components/schemas/AlertRule",
  "type": "object",
  "required": [
    "id",
    "targetType",
    "targetId",
    "targetLabel",
    "enabled",
    "state",
    "destinations",
    "misconfigured",
    "inAppForMe"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "targetType": {
      "type": "string",
      "enum": [
        "schedule",
        "testConfig",
        "batch"
      ]
    },
    "targetId": {
      "type": "string"
    },
    "targetLabel": {
      "type": "string",
      "description": "The name of what the rule watches",
      "or its id when no name is found.": null
    },
    "event": {
      "type": "string",
      "enum": [
        "run_failed"
      ]
    },
    "condition": {
      "type": "object",
      "additionalProperties": true
    },
    "destinationIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "destinations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "enabled": {
      "type": "boolean"
    },
    "datapointsToAlarm": {
      "type": "integer"
    },
    "evaluationPeriods": {
      "type": "integer"
    },
    "state": {
      "type": "string",
      "enum": [
        "OK",
        "IN_ALARM"
      ]
    },
    "stateChangedAt": {
      "type": "string"
    },
    "mutedUntil": {
      "type": "string"
    },
    "suppressWhenCovered": {
      "type": "boolean"
    },
    "misconfigured": {
      "type": "boolean"
    },
    "inAppForMe": {
      "type": "boolean"
    },
    "createdBy": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    }
  },
  "additionalProperties": true
}