#!/bin/bash
# Healthcheck for Zigbee2MQTT

# Check if the container is running
if ! docker ps --filter "name=zigbee2mqtt" --filter "status=running" | grep -q "zigbee2mqtt"; then
    echo "[FAIL] Zigbee2MQTT container is not running"
    exit 1
fi

# Check frontend responsiveness
if ! curl -sf http://localhost:8080 > /dev/null; then
    echo "[FAIL] Zigbee2MQTT frontend is not responding"
    exit 1
fi

echo "[OK] Zigbee2MQTT is healthy"
exit 0
