#!/usr/bin/env bash
set -euo pipefail

echo "=== Magnum Opus Development Setup ==="

for cmd in mbsync notmuch bun; do
	if ! command -v "$cmd" &>/dev/null; then
		echo "ERROR: $cmd is not installed."
		echo "  brew install isync notmuch bun"
		exit 1
	fi
done

echo "All dependencies found."

MAIL_DIR="${HOME}/Mail/magnumopus-dev"
mkdir -p "$MAIL_DIR"

echo ""
echo "Next steps:"
echo "  1. Configure your IMAP account in backend/.env"
echo "  2. Run: cd backend && bun run dev"
echo "  3. Open clients/macos/MagnumOpus.xcodeproj in Xcode"
echo "  4. Run: bash scripts/dev-sync.sh  (to trigger first sync)"
