"""
Quick smoke test for the AI engine.
Run: python test_engine.py
Make sure you're in the ai-engine/ directory with your venv activated.
"""
import sys
import json

# --- Test parser with dummy text ---
sys.path.insert(0, ".")

from core.ats_scorer import compute_ats_score
from core.hackathon_scorer import compute_hackathon_score
from core.skill_matcher import analyze_skill_gap

SAMPLE_PARSED = {
    "name": "Alex Johnson",
    "email": "alex@example.com",
    "phone": "+1 555 123 4567",
    "skills": ["Python", "React", "JavaScript", "Node.js", "MongoDB", "Git", "Docker", "SQL"],
    "projects": [
        {
            "name": "E-commerce Platform",
            "description": "Built a full-stack e-commerce platform with React frontend and Node.js backend handling 500+ products",
            "techStack": ["React", "Node.js", "MongoDB"],
        },
        {
            "name": "Chat Application",
            "description": "Real-time chat app using WebSockets supporting 100 concurrent users",
            "techStack": ["Socket.io", "Express", "React"],
        },
        {
            "name": "Data Dashboard",
            "description": "Analytics dashboard visualizing sales data with interactive charts",
            "techStack": ["Python", "Pandas", "Chart.js"],
        },
    ],
    "experience": [
        {
            "company": "TechCorp",
            "role": "Junior Developer",
            "duration": "Jun 2023 – Present",
            "bullets": ["Built REST APIs", "Improved load time by 40%", "Collaborated with team of 5"],
        }
    ],
    "education": [
        {"institution": "State University", "degree": "B.Sc Computer Science", "field": "CS", "year": 2023}
    ],
    "certifications": ["AWS Cloud Practitioner", "Google Data Analytics"],
    "rawText": "Alex Johnson alex@example.com Python React JavaScript Node.js MongoDB Git Docker SQL built developed improved collaborated",
}

print("=" * 50)
print("CareerForge AI Engine — Smoke Test")
print("=" * 50)

print("\n1. ATS Score:")
ats = compute_ats_score(SAMPLE_PARSED, "Full Stack Developer")
print(json.dumps(ats, indent=2))

print("\n2. Hackathon Readiness:")
hackathon = compute_hackathon_score(SAMPLE_PARSED)
print(json.dumps(hackathon, indent=2))

print("\n3. Skill Gap (Frontend Developer):")
gap = analyze_skill_gap(SAMPLE_PARSED, "Frontend Developer")
print(json.dumps(gap, indent=2))

print("\n✅ All core modules working!")
print("Note: Roast mode requires ANTHROPIC_API_KEY to be set and calls the Claude API.")
