import { setParams } from '/@/utils';
import { defHttp } from '/@/utils/http/axios';
enum Api {
  infraJob = '/quartz/job/query/page',
  // onlineList = '/monitor/online/query/page',
  // onlineListToken = '/monitor/online/query/token/list',
  infraJobDetail = '/quartz/job/detail',
  infraJobAdd = '/quartz/job/add',
  infraJobEdit = '/quartz/job/edit',
  infraJobExecute = '/quartz/job/run',
  infraJobSwitch = '/quartz/job/changeStatus',
  infraJobDelete = '/quartz/job/removeByIds',
  infraJobLog = '/quartz/jobLog/query/page',
  infraJobLogDelete = '/quartz/jobLog/removeByIds',
}

/**
 * @description: 任务调度表
 * @method: POST
 * @params loginType string
 * @params token string
 */
export const infraJob = (params?: object) => {
  return defHttp.post({ url: Api.infraJob, params: setParams(params) });
};
/**
 * @description: 在线用户列表
 * @method: POST
 */
// export const onlineList = (params?: object) => {
//   return defHttp.post({ url: Api.onlineList, params: setParams(params) });
// };

// export const onlineListToken = (params?: object) => {
//   return defHttp.post({ url: Api.onlineListToken, params: setParams(params) });
// };
export const infraJobDetail = (id: string) => {
  return defHttp.get({ url: Api.infraJobDetail + '/' + id });
};
/**
 * @description: 任务调度表编辑
 * @method: POST
 */
export const infraJobEdit = (params?: object) => {
  return defHttp.post({ url: Api.infraJobEdit, params: params });
};
/**
 * @description: 任务调度表添加
 * @method: POST
 */
export const infraJobAdd = (params?: object) => {
  return defHttp.post({ url: Api.infraJobAdd, params: params });
};
/**
 * @description: 立即执行任务
 * @method: POST
 */
export const infraJobExecute = (id: string) => {
  return defHttp.post({ url: Api.infraJobExecute + '/' + id });
};
/**
 * @description: 切换任务状态
 * @method: POST
 */
export const infraJobSwitch = (params?: object) => {
  return defHttp.post({ url: Api.infraJobSwitch, params: params });
};
/**
 * @description: 删除表
 * @method: POST
 */
export const infraJobDelete = (params?: object) => {
  return defHttp.post({ url: Api.infraJobDelete, params: params });
};
/**
 * @description: 任务调度日志表
 * @method: POST
 * @params loginType string
 * @params token string
 */
export const infraJobLog = (params?: object) => {
  return defHttp.post({ url: Api.infraJobLog, params: params });
};
/**
 * @description: 删除日志
 * @method: POST
 */
export const infraJobLogDelete = (params?: object) => {
  return defHttp.post({ url: Api.infraJobLogDelete, params: params });
};
