import { useState, useEffect } from 'react'

const API_BASE = import.meta.env.VITE_API_URL || '/api'

export function useSuggestions() {
  const [suggestions, setSuggestions] = useState({ authors: [], books: [], chapters: [], reviewers: [] })

  useEffect(() => {
    fetch(`${API_BASE}/jobs/suggestions`)
      .then(r => r.ok ? r.json() : null)
      .then(data => { if (data) setSuggestions(data) })
      .catch(() => {})
  }, [])

  return suggestions
}
