import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PositionVO, PositionForm, PositionQuery } from '@/api/system/position/types';

/**
 * 查询【请填写功能名称】列表
 * @param query
 * @returns {*}
 */

export const listPosition = (query?: PositionQuery): AxiosPromise<PositionVO[]> => {
  return request({
    url: '/system/position/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询【请填写功能名称】详细
 * @param positionId
 */
export const getPosition = (positionId: string | number): AxiosPromise<PositionVO> => {
  return request({
    url: '/system/position/' + positionId,
    method: 'get'
  });
};

/**
 * 新增【请填写功能名称】
 * @param data
 */
export const addPosition = (data: PositionForm) => {
  return request({
    url: '/system/position',
    method: 'post',
    data: data
  });
};

/**
 * 修改【请填写功能名称】
 * @param data
 */
export const updatePosition = (data: PositionForm) => {
  return request({
    url: '/system/position',
    method: 'put',
    data: data
  });
};

/**
 * 删除【请填写功能名称】
 * @param positionId
 */
export const delPosition = (positionId: string | number | Array<string | number>) => {
  return request({
    url: '/system/position/' + positionId,
    method: 'delete'
  });
};
