{
  "conditions": [],
  "steps": [
    { "type": "start", "triggerType": "Form", "formIds": [13, 14, 15, 16, 17, 18, 19] },
    { "type": "load_record", "table": "ohs_incidents", "id_key": "record_id", "context_key": "incident" },
    { "type": "query_records", "table": "incident_alert_rules", "where": { "incident_type_id": "{classification}", "severity": "{severity}", "location_id": "{location_id}" }, "context_key": "recipients" },
    { "type": "for_each_record", "list_key": "recipients", "steps": [
      { "type": "condition", "field": "send_email", "operator": "==", "value": true },
      { "type": "email", "to": "{email}", "message": "Incident {record_id} reported" },
      { "type": "condition", "field": "send_sms", "operator": "==", "value": true },
      { "type": "sms", "to": "{phone}", "message": "Incident {record_id} reported" },
      { "type": "condition", "field": "send_push", "operator": "==", "value": true },
      { "type": "alert", "user_id": "{send_alert_to}", "title": "New Incident", "body": "Incident {record_id} reported" }
    ] }
  ]
}
