#!/bin/bash
# IEEE 802.1 Document Indexer - Setup Script
# Run this first to set up your environment

set -e

echo "Setting up IEEE 802.1 Document Indexer..."

# Create project directory structure
mkdir -p ieee_indexer
cd ieee_indexer

# Create virtual environment
echo "Creating virtual environment..."
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate

# Upgrade pip
pip install --upgrade pip

# Install required packages
echo "Installing dependencies..."
pip install anthropic pdfplumber beautifulsoup4 lxml tqdm

# Create necessary directories
mkdir -p output
mkdir -p logs

# Create .env file template
cat > .env << 'EOF'
# Add your Anthropic API key here
ANTHROPIC_API_KEY=your_api_key_here

# Base path to IEEE 802 documents
BASE_PATH=/home/mark/files.serialport.org/ieee802

# Years to process (comma-separated)
YEARS=1994,1995,1996,1997,1998
EOF

echo ""
echo "Setup complete!"
echo ""
echo "Next steps:"
echo "1. Edit .env file and add your Anthropic API key"
echo "2. Verify BASE_PATH in .env points to your documents"
echo "3. Run: source venv/bin/activate"
echo "4. Run: python scanner.py"
echo "5. Run: python processor.py"
echo "6. Run: python generate_index.py"
echo ""
