#!/bin/bash

# Claude Code Tracker - Quick Hook Setup
# Simple wrapper for the full installation script

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_SCRIPT="$SCRIPT_DIR/install-hooks.sh"

# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'

echo -e "${BLUE}Claude Code Tracker - Quick Hook Setup${NC}"
echo ""

# Check if install script exists
if [[ ! -f "$INSTALL_SCRIPT" ]]; then
    echo "Error: Installation script not found at $INSTALL_SCRIPT"
    exit 1
fi

# Check if domain is set
if [[ -z "$DOMAIN" ]]; then
    if [[ -f "$SCRIPT_DIR/.env" ]]; then
        source "$SCRIPT_DIR/.env"
    fi
    
    if [[ -z "$DOMAIN" ]]; then
        echo "Please set the DOMAIN environment variable first:"
        echo ""
        echo "  export DOMAIN=your-domain.com"
        echo "  ./setup-hooks"
        echo ""
        echo "Or create a .env file with:"
        echo "  DOMAIN=your-domain.com"
        exit 1
    fi
fi

echo -e "${GREEN}Using domain: $DOMAIN${NC}"
echo ""

# Run the installation with comprehensive profile (best for most users)
exec "$INSTALL_SCRIPT" comprehensive "$@"