{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-alert-rule-schema.json",
  "title": "AlertRule",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-alert-rules-api-openapi.yml#/components/schemas/AlertRule",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Alert rule id."
    },
    "spaceId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "trigger": {
      "type": "string",
      "description": "The first trigger code, e.g. `connection-lost`."
    },
    "config": {
      "$ref": "#/$defs/AlertRuleConfig"
    },
    "enabled": {
      "type": "boolean"
    },
    "nodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Home location; null = workspace root."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "deletedAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "spaceId",
    "name",
    "trigger",
    "config",
    "enabled",
    "nodeId",
    "createdAt",
    "updatedAt",
    "deletedAt"
  ],
  "$defs": {
    "AlertRuleConfig": {
      "type": "object",
      "properties": {
        "codes": {
          "description": "Every trigger code the rule watches; the first is also `trigger`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "severity": {
          "type": "string"
        },
        "scopeKind": {
          "description": "`workspace`, `org_unit`, `location`, `screen_group` or `screen`.",
          "type": "string"
        },
        "scopeId": {
          "type": "string"
        },
        "thresholds": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        "channels": {
          "description": "`in-app`, `email`, `webhook`, `teams`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "recipients": {
          "description": "Email addresses, `role:` tokens and webhook URLs. Webhook URLs are Masked: a delivery URL is a credential (a Microsoft Teams workflow URL carries it in `sig=`), so every response shows the host and the last four characters only — `https://prod-12.westus.logic.azure.com/…?sig=••••a1b2`. On update, send a masked value back unchanged to keep the saved URL, or a full URL to replace it.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "teamsUrls": {
          "description": "Microsoft Teams workflow URLs for the `teams` channel. Masked: a delivery URL is a credential (a Microsoft Teams workflow URL carries it in `sig=`), so every response shows the host and the last four characters only — `https://prod-12.westus.logic.azure.com/…?sig=••••a1b2`. On update, send a masked value back unchanged to keep the saved URL, or a full URL to replace it.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": {},
      "description": "The rule's trigger, scope and delivery settings. Other keys pass through unchanged."
    }
  }
}