import { cache } from "react";
import "server-only";

export interface ProjectResult {
  id: number;
  code: string;
  name: string;
  category: "Confirmed Project" | "Project to be bidded";
  team: string;
  client: string;
}

export const preloadProjects = () => {
  fetchProjects();
};

export const fetchProjects = cache(async () => {
  return mockProjects;
});

const mockProjects: ProjectResult[] = [
  {
    id: 1,
    code: "M1001",
    name: "Consultancy Project A",
    category: "Confirmed Project",
    team: "TW",
    client: "Client A",
  },
  {
    id: 2,
    code: "M1002",
    name: "Consultancy Project B",
    category: "Project to be bidded",
    team: "WY",
    client: "Client B",
  },
  {
    id: 3,
    code: "S1001",
    name: "Consultancy Project C",
    category: "Confirmed Project",
    team: "WY",
    client: "Client C",
  },
];
