from fastapi import HTTPException
from app.salary_analytics.core.state import state


def check_data_loaded():
    """Raise HTTP 400 if no data is loaded into the pipeline."""
    if state.pipeline.df is None:
        raise HTTPException(
            status_code=400,
            detail="No data loaded. Please load data first using the /load-data endpoint."
        )
    return True
