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

enum Api {
  sysPosQueryPage = '/sys/pos/query/page',
  sysPosDetail = '/sys/pos/detail',
  sysPosAdd = '/sys/pos/add',
  sysPosEdit = '/sys/pos/edit',
  sysPosRemove = '/sys/pos/removeByIds',
}

/**
 *
 * @author lf
 * @date  2023/05/04 14:05
 * @description: 根据条件查询岗位管理列表,权限 - sys:pos:query
 * @method: POST
 * @param:
 * @return:
 */

export const sysPosQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.sysPosQueryPage, params: setParams(params) });
};
/**
 *
 * @author lf
 * @date  2023/05/04 14:05
 * @description: 根据id查询岗位管理详细信息,权限 - sys:pos:query
 * @method: GET
 * @param:  id 岗位管理主键id
 * @return:
 */
export const sysPosDetail = (id: string) => {
  return defHttp.get({ url: Api.sysPosDetail + '/' + id });
};

/**
 *
 * @author lf
 * @date  2023/05/04 14:05
 * @description: 添加岗位管理,权限 - sys:pos:add
 * @method: POST
 * @param:
 * @return:
 *       0 添加失败
 *       1 添加成功
 */
export const sysPosAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysPosAdd, params: params });
};

/**
 *
 * @author lf
 * @date  2023/05/04 14:05
 * @description: 通过主键id编辑岗位管理,权限 - sys:pos:edit
 * @method: POST
 * @param:
 * @return:
 *       0 编辑失败
 *       1 编辑成功
 */
export const sysPosEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysPosEdit, params: params });
};

/**
 * @description: 删除,权限 - sys:pos:remove
 * @method: POST
 */
export const sysPosRemove = (params: Array<string | number>) => {
  return defHttp.post({ url: Api.sysPosRemove, params: params });
};
