import { baseApiRequest } from "../apiRequests/baseApiRequest";
import { DashboardWidgetsResponseDto, StatusWiseProjectResponseData } from "./types";

const PROJECT_DASHBOARD_API = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1/dashboard`;

export const getWidgetsData: () => Promise<DashboardWidgetsResponseDto> = async () => {
  return baseApiRequest(
    `${PROJECT_DASHBOARD_API}/widgets`,
    {
      method: "GET",
      cache: "no-store", 
    },
    { isAccessTokenRequird: true },
  );
};

export const getStatusWiseProjectCount: () => Promise<StatusWiseProjectResponseData> = async () => {
  return baseApiRequest(
    `${PROJECT_DASHBOARD_API}/status-wise-projects`,
    {
      method: "GET",
      cache: "no-store", 
    },
    { isAccessTokenRequird: true },
  );
};
