import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  sysMenuAdd = '/sys/menu/add',
  sysMenuDetailId = '/sys/menu/detail',
  sysMenuEdit = '/sys/menu/edit',
  sysMenuQueryPage = '/sys/menu/query/page',
  sysMenuQueryTree = '/sys/menu/query/tree',
  sysMenuRemove = '/sys/menu/deleteByIds',
}

/**
 * @description: 新增菜单,权限 - sys:menu:add
 * @method: POST
 */
export const sysMenuAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysMenuAdd, params: params });
};
/**
 * @description: 获取菜单详细信息,权限 - sys:menu:query
 * @method: GET
 */
export const sysMenuDetailId = (id?: string | number, params?: object) => {
  return defHttp.get({ url: Api.sysMenuDetailId + '/' + id, params: params });
};
/**
 * @description: 通过主键id修改菜单,权限 - sys:menu:edit
 * @method: POST
 */
export const sysMenuEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysMenuEdit, params: params });
};

/**
 * @description: 查询菜单列表,权限 - sys:menu:query
 * @method: POST
 */
export const sysMenuQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.sysMenuQueryPage, params: setParams(params) });
};

/**
 * @description: 查询菜单列表,权限 - sys:menu:query
 * @method: POST
 */
export const sysMenuQueryTree = (params?: object) => {
  return defHttp.post({ url: Api.sysMenuQueryTree, params: setParams(params) });
};

/**
 * @description: 删除增菜单,权限 - sys:menu:remove
 * @method: POST
 */

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