import { request } from "@/api/request";


/** 获取报表 */
export const fetchReports = (data: { page: number, size: number, keyword?: string }) => request.get("/api/v1/report/basics", { params: data });

/** 创建报表任务 */
export const fetchReportNewTask = (keyName:string,data: any) => request.post("/api/v1/report/task/new/"+keyName, data);

/** 获取报表基础信息详情 */
export const fetchReportBasicInfo = (id: string) => request.get(`/api/v1/report/basics/${id}`);

/** 获取指定报表的调度列表 */
export const fetchReportSchedules = (report_basic_id: string) => request.get(`/api/v1/report/schedules/${report_basic_id}`);

/** 批量创建报表调度 */
export const fetchReportSchedulesBatch = (data: any) => request.post("/api/v1/report/schedules/batch", data);

/** 获取指定报表的历史记录列表 */
export const fetchReportHistories = (report_basic_id: string) => request.get(`/api/v1/report/histories/${report_basic_id}?status=2`);

/** 获取报表历史记录列表 */
export const fetchReportHistoriesList = (data: { page: number, size: number, keyword?: string }) => request.get("/api/v1/report/histories", { params: data });

/** 获取邮件推送记录列表 */
export enum PushStatus {
  /** 发送成功 */
  Success = 1,
  /** 发送失败 */
  Failed = 2
}
export const fetchReportPushesList = (data: { page: number, size: number, keyword?: string, status?: PushStatus }) => request.get("/api/v1/report/pushes", { params: data });

/** 重新发送邮件 */
export const fetchReportPushesResend = (id: number) => request.post(`/api/v1/report/pushes/${id}`);
