import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  sysConfigAdd = '/sys/config/add',
  sysConfigDetailConfigId = '/sys/config/detail',
  sysConfigEdit = '/sys/config/edit',
  sysConfigExport = '/sys/config/export',
  sysConfigQueryList = '/sys/config/query/list',
  sysConfigRemove = '/sys/config/remove',
  sysConfigCurrent = '/sys/config/get/current',
}

/**
 * @description: 新增参数设置,权限 - sys:config:add
 * @method: POST
 */
export const sysConfigAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysConfigAdd, params: params });
};
/**
 * @description: 获取参数设置详细信息,权限 - sys:config:query
 * @method: GET
 */
export const sysConfigDetailConfigId = (configId?: string | number, params?: object) => {
  return defHttp.get({ url: Api.sysConfigDetailConfigId + '/' + configId, params: params });
};
/**
 * @description: 通过主键id修改参数设置,权限 - sys:config:edit
 * @method: POST
 */
export const sysConfigEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysConfigEdit, params: params });
};
/**
 * @description: 导出参数设置
 * @method: POST
 */
export const sysConfigExport = (params?: object) => {
  return defHttp.post({ url: Api.sysConfigExport, params: params });
};
/**
 * @description: 查询参数设置列表,权限 - sys:config:list
 * @method: POST
 */

export const sysConfigQueryList = (params?: object) => {
  return defHttp.post({ url: Api.sysConfigQueryList, params: setParams(params) });
};
/**
 * @description: 删除参数设置,权限 - sys:config:remove
 * @method: POST
 */

export const sysConfigRemove = (params?: Array<string | number>) => {
  return defHttp.post({ url: Api.sysConfigRemove, params: params });
};

/**
 * @description: 获取系统当前配置
 * @method: GET
 */
export const sysConfigCurrent = () => {
  return defHttp.get({ url: Api.sysConfigCurrent });
};
