{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.api-evangelist.com/opsgenie/heartbeat.json",
  "title": "OpsGenie Heartbeat",
  "description": "Represents a heartbeat monitor that tracks the health and availability of systems and services. When a monitored system fails to send a ping within the configured interval, OpsGenie generates an alert.",
  "type": "object",
  "required": ["name", "interval", "intervalUnit", "enabled"],
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the heartbeat monitor, used as its identifier."
    },
    "description": {
      "type": "string",
      "description": "Description of what the heartbeat monitors."
    },
    "interval": {
      "type": "integer",
      "minimum": 1,
      "description": "Expected ping interval duration."
    },
    "intervalUnit": {
      "type": "string",
      "enum": ["minutes", "hours", "days"],
      "description": "Unit for the ping interval."
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether the heartbeat is currently active."
    },
    "expired": {
      "type": "boolean",
      "description": "Whether the heartbeat has missed its expected ping window."
    },
    "lastPingTime": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time of the last successful ping."
    },
    "ownerTeam": {
      "type": "object",
      "description": "Team that owns the heartbeat.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Team ID."
        },
        "name": {
          "type": "string",
          "description": "Team name."
        }
      }
    },
    "alertMessage": {
      "type": "string",
      "description": "Custom message for the alert generated when the heartbeat expires."
    },
    "alertTags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tags added to the alert generated by an expired heartbeat."
    },
    "alertPriority": {
      "type": "string",
      "enum": ["P1", "P2", "P3", "P4", "P5"],
      "description": "Priority of the alert generated by an expired heartbeat."
    }
  }
}
