import { request } from '@/utils/request'
import { Dashboard } from '@/enums/api'
import {
  ProjectCategoryStatResParams,
  ProjectMonthCountStatReqParams,
  ProjectMonthCountStatResParams,
  ProjectMultiStatResParams,
  ProjectPlanStatReqParams,
  ProjectPlanStatResParams
} from '@/types/dashboard'

/**
 * 获取项目分类统计
 * @returns
 */
export const getProjectCategoryStat = () => {
  return request.post<ProjectCategoryStatResParams>({
    url: Dashboard.REPORT_PRJOJECT_CAT_STAT,
    data: {}
  })
}

/**
 * 获取项目计划统计
 * @param ProjectPlanStatReqParams
 * @returns
 */
export const getProjectPlanStat = (params: ProjectPlanStatReqParams) => {
  return request.post<ProjectPlanStatResParams>({
    url: Dashboard.REPORT_PRJOJECT_PLAN_STAT,
    data: params
  })
}

/**
 * 获取项目数量累计，每月底计算一次累计值，每月一条数据
 * @param ProjectMonthCountStatReqParams
 * @returns
 */
export const getProjectMonthCountStat = (
  params: ProjectMonthCountStatReqParams
) => {
  return request.post<ProjectMonthCountStatResParams>({
    url: Dashboard.REPORT_PRJOJECT_COUNT_STAT,
    data: params
  })
}

/**
 * 获取项目数量累计，每月底计算一次累计值，每月一条数据
 * @param ProjectMonthCountStatReqParams
 * @returns
 */
export const getProjectMultiStat = () => {
  return request.post<ProjectMultiStatResParams>({
    url: Dashboard.REPORT_PRJOJECT_MULTI_STAT,
    data: {}
  })
}
