import { cache } from "react";

export interface ResourceSummaryResult {
  id: number;
  projectCode: string;
  projectName: string;
  clientCode: string;
  clientName: string;
  clientCodeAndName: string;
}

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

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

const mockProjects: ResourceSummaryResult[] = [
  {
    id: 1,
    projectCode: 'C-1001-001',
    projectName: 'Consultancy Project A',
    clientCode: 'Client-001',
    clientName: 'AAA Construction',
    clientCodeAndName: 'Client-001 - AAA Construction',
  },
  {
    id: 2,
    projectCode: 'C-1002-001',
    projectName: 'Consultancy Project B',
    clientCode: 'Client-001',
    clientName: 'AAA Construction',
    clientCodeAndName: 'Client-001 - AAA Construction',
  },
  {
    id: 3,
    projectCode: 'C-1003-001',
    projectName: 'Consultancy Project C',
    clientCode: 'Client-002',
    clientName: 'BBB Construction',
    clientCodeAndName: 'Client-002 - BBB Construction',
  },
  {
    id: 4,
    projectCode: 'C-1004-001',
    projectName: 'Consultancy Project D',
    clientCode: 'Client-002',
    clientName: 'BBB Construction',
    clientCodeAndName: 'Client-002 - BBB Construction',
  },
];
