"""
Quick test to verify ActivityCategorizer is working correctly
"""
import sys
import os

# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

# Import and test
try:
    from activity_categorizer import ActivityCategorizer
    
    print("✅ Successfully imported ActivityCategorizer")
    
    # Create instance
    categorizer = ActivityCategorizer()
    print("✅ Successfully created ActivityCategorizer instance")
    
    # Check attributes
    print("\n📋 Checking attributes:")
    attrs = ['productive_patterns', 'browser_patterns', 'server_patterns', 'non_work_patterns']
    
    for attr in attrs:
        if hasattr(categorizer, attr):
            print(f"  ✅ {attr}: found ({len(getattr(categorizer, attr))} patterns)")
        else:
            print(f"  ❌ {attr}: NOT FOUND")
    
    # Check for the problematic attribute
    if hasattr(categorizer, 'non_work_keywords'):
        print("  ⚠️  non_work_keywords: FOUND (this should be non_work_patterns!)")
    else:
        print("  ✅ non_work_keywords: not found (correct)")
    
    # Test categorization
    print("\n📋 Testing categorization:")
    test_cases = [
        ("Visual Studio Code", "Code.exe"),
        ("YouTube - Google Chrome", "chrome.exe"),
        ("AWS Console", "chrome.exe")
    ]
    
    for title, app in test_cases:
        try:
            result = categorizer.get_detailed_category(title, app)
            print(f"  ✅ {title}: {result['category']}")
        except Exception as e:
            print(f"  ❌ {title}: Error - {e}")
    
    print("\n✅ All tests completed!")
    
except Exception as e:
    print(f"❌ Error: {e}")
    import traceback
    traceback.print_exc()
