#!/bin/bash
FORM="https://digitalonellc.com/#book"
TITLE="DigitalOne"
choice=$(osascript <<'APP' 2>/dev/null || true
set theChoice to button returned of (display dialog "Digital One support" buttons {"Start / reconnect", "Request service"} default button 1 with title "DigitalOne")
return theChoice
APP
)
case "$choice" in
  "Start / reconnect")
    osascript -e 'do shell script "if /bin/launchctl print system/meshagent >/dev/null 2>&1; then /bin/launchctl kickstart -k system/meshagent; else /bin/launchctl bootstrap system /Library/LaunchDaemons/meshagent.plist || /bin/launchctl load /Library/LaunchDaemons/meshagent.plist; fi" with administrator privileges' >/dev/null 2>&1 || true
    ;;
  "Request service")
    open "$FORM"
    ;;
esac
exit 0
