import { cache } from "react";

export interface ClientProjectResult {
  id: number;
  clientCode: string;
  clientName: string;
  SubsidiaryClientCode: string;
  SubsidiaryClientName: string;
  NoOfProjects: number;
}

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

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

const mockProjects: ClientProjectResult[] = [
  {
    id: 1,
    clientCode: "CUST-001",
    clientName: "Client A",
    SubsidiaryClientCode: "N/A",
    SubsidiaryClientName: "N/A",
    NoOfProjects: 5,
  },
  {
    id: 1,
    clientCode: "CUST-001",
    clientName: "Client A",
    SubsidiaryClientCode: "SUBS-001",
    SubsidiaryClientName: "Subsidiary A",
    NoOfProjects: 5,
  },
  {
    id: 1,
    clientCode: "CUST-001",
    clientName: "Client A",
    SubsidiaryClientCode: "SUBS-002",
    SubsidiaryClientName: "Subsidiary B",
    NoOfProjects: 3,
  },
  {
    id: 1,
    clientCode: "CUST-001",
    clientName: "Client A",
    SubsidiaryClientCode: "SUBS-003",
    SubsidiaryClientName: "Subsidiary C",
    NoOfProjects: 1,
  },
];
