import { useState, useEffect } from "react";

const ProjectInfo = (userId) => {
  const [projectData, setProjectData] = useState(null);
  const [error, setError] = useState(null);

  useEffect(() => {
    const fetchData = async () => {
      try {
        // Placeholder for fetching project data
        const response = [
          {
            "Project ID": "1",
            Title: "Example Project",
            URL: "https://example.com",
            Services: "Service1, Service2",
            "Price Monthly": 100,
            "PDF Contract": null,
          },
        ];

        const formattedData = response.map((item) => ({
          "Project ID": item["Project ID"],
          Title: item.Title,
          URL: item.URL,
          Services: item.Services,
          "Price Monthly": item["Price Monthly"],
          "PDF Contract": item["PDF Contract"],
        }));

        setProjectData(formattedData);
      } catch (err) {
        setError(err.message);
      }
    };

    fetchData();
  }, [userId]);

  return { projectData };
};

export default ProjectInfo;
