"use server";

import { serverFetchJson } from "@/app/utils/fetchUtil";
import { BASE_API_URL } from "@/config/api";
import { Dayjs } from "dayjs";
import { cache } from "react";    


export interface ClientSubsidiaryProjectResult {
  color: string;
  projectId: number;
  projectCode: string;
  projectName: string;
  team: string;
  teamLead: string;
  expectedStage: string;
  budgetedManhour: number;
  spentManhour: number;
  remainedManhour: number;
  manhourConsumptionPercentage: number;
  comingPaymentMilestone: string;
}

export const fetchAllTeamProjects = cache(async (teamLeadId: number) => {
    return serverFetchJson<ClientSubsidiaryProjectResult[]>(
      `${BASE_API_URL}/dashboard/searchTeamProject?teamLeadId=${teamLeadId}`
    );

});
