import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';

enum Api {
  sysDictAdd = '/sys/dict/add',
  sysDictEdit = '/sys/dict/edit',
  sysDictQueryPage = '/sys/dict/query/page',
  sysDictQueryTree = '/sys/dict/query/tree',
  sysDictRemove = '/sys/dict/deleteByIds',
  sysDictQueryList = '/sys/dict/query/list',
}

/**
 * @description: 新增字典,权限 - sys:dict:add
 * @method: POST
 */
export const sysDictAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysDictAdd, params: params });
};
/**
 * @description: 通过主键id修改字典,权限 - sys:dict:edit
 * @method: POST
 */
export const sysDictEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysDictEdit, params: params });
};
/**
 * @description: 查询字典列表,权限 - sys:dict:list
 * @method: POST
 */
export const sysDictQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.sysDictQueryPage, params: setParams(params) });
};
/**
 * @description: 查询字典树,权限 - sys:dict:list
 * @method: POST
 */
export const sysDictQueryTree = (params?: object) => {
  return defHttp.post({ url: Api.sysDictQueryTree, params: params });
};

/**
 * @description: 查询字典列表,权限 - sys:dict:list
 * @method: POST
 */
export const sysDictQueryList = (params?: object) => {
  return defHttp.post({ url: Api.sysDictQueryList, params });
};
/**
 * @description: 删除字典,权限 - sys:dict:remove
 * @method: POST
 */
export const sysDictRemove = (params?: object) => {
  return defHttp.post({ url: Api.sysDictRemove, params: params });
};
