{
  "type": "object",
  "properties": {
    "aggregate_function": {
      "description": "Aggregate function to apply to the selected values before applying the condition. [none, sum, average, max, min]",
      "type": "string",
      "enum": [
        "none",
        "sum",
        "average",
        "max",
        "min"
      ]
    },
    "aggregate_window": {
      "description": "The time window to aggregate the selected values. It follows the format of a number followed by a time unit",
      "type": "string",
      "example": "10m or 5h30m40s",
      "pattern": "^[0-9]+[smh]$"
    },
    "alert": {
      "description": "If true, the monitor is in alert state.",
      "type": "boolean"
    },
    "alert_routes": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/SlackWebHookNotification"
          },
          {
            "$ref": "#/components/schemas/SlackBearerNotification"
          },
          {
            "$ref": "#/components/schemas/EmailNotification"
          }
        ]
      }
    },
    "condition_type": {
      "description": "A comparison operation to apply to the value selected by the source_selector [greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to, equal_to, not_equal_to]",
      "type": "string",
      "enum": [
        "greater_than",
        "greater_than_or_equal_to",
        "less_than",
        "less_than_or_equal_to",
        "equal_to",
        "not_equal_to",
        "count"
      ]
    },
    "description": {
      "type": "string"
    },
    "disabled": {
      "description": "If true, the monitor will not be evaluated.",
      "type": "boolean"
    },
    "fleet_filter": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "last_routed_at": {
      "description": "The last time the monitor was evaluated and routed.",
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "notefile_filter": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "per_device": {
      "description": "Only relevant when using an aggregate_function. If true, the monitor will be evaluated per device, | rather than across the set of selected devices. If true then if a single device matches the specified criteria, | and alert will be created, otherwise the aggregate function will be applied across all devices.",
      "type": "boolean"
    },
    "routing_cooldown_period": {
      "description": "The time period to wait before routing another event after the monitor | has been triggered. It follows the format of a number followed by a time unit.",
      "type": "string",
      "example": "10m or 5h30m40s",
      "pattern": "^[0-9]+[smh]$"
    },
    "silenced": {
      "description": "If true, alerts will be created, but no notifications will be sent.",
      "type": "boolean"
    },
    "source_selector": {
      "description": "A valid JSONata expression that selects the value to monitor from the source. | It should return a single, numeric value.",
      "type": "string",
      "example": "body.temperature"
    },
    "source_type": {
      "description": "The type of source to monitor. Supported values are \"event\" and \"heartbeat\".",
      "type": "string",
      "enum": [
        "event",
        "heartbeat"
      ]
    },
    "threshold": {
      "description": "The type of condition to apply to the value selected by the source_selector",
      "type": "integer"
    },
    "uid": {
      "type": "string"
    },
    "usage_scope": {
      "description": "For usage monitors: the scope of aggregation. Supported values are \"device\" and \"fleet\".",
      "type": "string"
    },
    "usage_type": {
      "description": "For usage monitors: the type of data usage to monitor. Supported values are \"cellular\" and \"satellite\".",
      "type": "string"
    },
    "usage_window": {
      "description": "For usage monitors: the rolling time window in days to sum usage over (e.g. 30 for 30 days).",
      "type": "integer",
      "format": "int32"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Monitor"
}