import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkWageVO, WorkWageForm, WorkWageQuery } from '@/api/project/workWage/types';

/**
 * 查询工种薪水列表
 * @param query
 * @returns {*}
 */

export const listWorkWage = (query?: WorkWageQuery): AxiosPromise<WorkWageVO[]> => {
  return request({
    url: '/project/workWage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工种薪水详细
 * @param id
 */
export const getWorkWage = (id: string | number): AxiosPromise<WorkWageVO> => {
  return request({
    url: '/project/workWage/' + id,
    method: 'get'
  });
};

/**
 * 新增工种薪水
 * @param data
 */
export const addWorkWage = (data: WorkWageForm) => {
  return request({
    url: '/project/workWage',
    method: 'post',
    data: data
  });
};

/**
 * 修改工种薪水
 * @param data
 */
export const updateWorkWage = (data: WorkWageForm) => {
  return request({
    url: '/project/workWage',
    method: 'put',
    data: data
  });
};

/**
 * 删除工种薪水
 * @param id
 */
export const delWorkWage = (id: string | number | Array<string | number>) => {
  return request({
    url: '/project/workWage/' + id,
    method: 'delete'
  });
};
