from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from core.skill_matcher import analyze_skill_gap

router = APIRouter()

class SkillGapRequest(BaseModel):
    parsed: dict
    targetRole: str

@router.post("/skill-gap")
def skill_gap(req: SkillGapRequest):
    try:
        return analyze_skill_gap(req.parsed, req.targetRole)
    except Exception as e:
        raise HTTPException(status_code=400, detail=str(e))
