#!/bin/bash
# Grid Checkpoint Hook
# Notifies user when a checkpoint requires attention

INPUT=$(cat)
CHECKPOINT_TYPE=$(echo "$INPUT" | jq -r '.type // "decision"')
CHECKPOINT_MSG=$(echo "$INPUT" | jq -r '.message // "Checkpoint reached"')

MESSAGE="$CHECKPOINT_MSG"

echo "{\"event\": \"checkpoint\", \"title\": \"Grid Checkpoint\", \"message\": \"$MESSAGE\"}" | \
    bash "$(dirname "$0")/notify.sh"

exit 0
