import { request, POST } from "@/utils/request";
import type { ApiResponse, QueryParams } from "@/utils/request";
import { dataApi } from "./apiPaths";

// 获取爬虫静态数据列表
export function getStatsDataList(params: QueryParams): Promise<ApiResponse> {
  return request({
    url: dataApi.dataStatistics,
    method: POST,
    params,
    timeout: 60000, // 一分钟
  } as any) as unknown as Promise<ApiResponse>;
}

// 获取爬虫任务列表
export function getSpiderTaskList(params: QueryParams): Promise<ApiResponse> {
  return request({
    url: dataApi.taskStatistics,
    method: POST,
    params,
  }) as unknown as Promise<ApiResponse>;
}

// 获取性能统计列表
export function getPerformanceList(params: QueryParams): Promise<ApiResponse> {
  return request({
    url: dataApi.performanceStatistics,
    method: POST,
    params,
  }) as unknown as Promise<ApiResponse>;
}

// 获取爬虫任务统计列表
export function getAllSpiderTaskStatistics(params: QueryParams): Promise<ApiResponse> {
  return request({
    url: dataApi.allSpiderTaskStatistics,
    method: POST,
    params,
  }) as unknown as Promise<ApiResponse>;
}