// assets/js/pages/user/useUserState.js
const { useState } = React;

const useUserState = () => {
  const [user, setUser] = useState(null);
  const [activeTab, setActiveTab] = useState("browse");
  const [stats, setStats] = useState({
    lost_items: 0,
    found_items: 0,
    claims: 0,
  });
  const [items, setItems] = useState([]);
  const [filteredItems, setFilteredItems] = useState([]);
  const [searchTerm, setSearchTerm] = useState("");
  const [categoryFilter, setCategoryFilter] = useState("");
  const [selectedItem, setSelectedItem] = useState(null);
  const [showDetailModal, setShowDetailModal] = useState(false);
  const [showClaimModal, setShowClaimModal] = useState(false);
  const [showReportLostModal, setShowReportLostModal] = useState(false);
  const [showReportFoundModal, setShowReportFoundModal] = useState(false);
  const [toast, setToast] = useState(null);
  const [loading, setLoading] = useState(false);
  const [myFoundItems, setMyFoundItems] = useState([]);
  const [myLostItems, setMyLostItems] = useState([]);
  const [publicLostItems, setPublicLostItems] = useState([]);
  const [photoPreview, setPhotoPreview] = useState(null);
  const [myClaims, setMyClaims] = useState([]);
  const [showSelectLostItemModal, setShowSelectLostItemModal] = useState(false);
  const [suggestedLostItems, setSuggestedLostItems] = useState([]);
  const [claimInitialData, setClaimInitialData] = useState(null);
  const [categories, setCategories] = useState([]);
  const [showFoundOptionModal, setShowFoundOptionModal] = useState(false);
  const [selectedLostItemForFound, setSelectedLostItemForFound] =
    useState(null);
  const [foundReportMethod, setFoundReportMethod] = useState(null);
  const [showDirectClaimModal, setShowDirectClaimModal] = useState(false);

  return {
    user,
    setUser,
    activeTab,
    setActiveTab,
    stats,
    setStats,
    items,
    setItems,
    filteredItems,
    setFilteredItems,
    searchTerm,
    setSearchTerm,
    categoryFilter,
    setCategoryFilter,
    selectedItem,
    setSelectedItem,
    showDetailModal,
    setShowDetailModal,
    showClaimModal,
    setShowClaimModal,
    showReportLostModal,
    setShowReportLostModal,
    showReportFoundModal,
    setShowReportFoundModal,
    toast,
    setToast,
    loading,
    setLoading,
    myFoundItems,
    setMyFoundItems,
    myLostItems,
    setMyLostItems,
    publicLostItems,
    setPublicLostItems,
    photoPreview,
    setPhotoPreview,
    myClaims,
    setMyClaims,
    showSelectLostItemModal,
    setShowSelectLostItemModal,
    suggestedLostItems,
    setSuggestedLostItems,
    claimInitialData,
    setClaimInitialData,
    categories,
    setCategories,
    showFoundOptionModal,
    setShowFoundOptionModal,
    selectedLostItemForFound,
    setSelectedLostItemForFound,
    foundReportMethod,
    setFoundReportMethod,
    showDirectClaimModal,
    setShowDirectClaimModal,
  };
};

// Export to window
window.useUserState = useUserState;
