import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseToolingInfoVO, BaseToolingInfoForm, BaseToolingInfoQuery } from '@/api/mes/baseToolingInfo/types';

/**
 * 查询载具工装信息列表
 * @param query
 * @returns {*}
 */

export const listBaseToolingInfo = (query?: BaseToolingInfoQuery): AxiosPromise<BaseToolingInfoVO[]> => {
  return request({
    url: '/mes/baseToolingInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询载具工装信息详细
 * @param toolingId
 */
export const getBaseToolingInfo = (toolingId: string | number): AxiosPromise<BaseToolingInfoVO> => {
  return request({
    url: '/mes/baseToolingInfo/' + toolingId,
    method: 'get'
  });
};

/**
 * 新增载具工装信息
 * @param data
 */
export const addBaseToolingInfo = (data: BaseToolingInfoForm) => {
  return request({
    url: '/mes/baseToolingInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改载具工装信息
 * @param data
 */
export const updateBaseToolingInfo = (data: BaseToolingInfoForm) => {
  return request({
    url: '/mes/baseToolingInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除载具工装信息
 * @param toolingId
 */
export const delBaseToolingInfo = (toolingId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseToolingInfo/' + toolingId,
    method: 'delete'
  });
};


/**
 * 下拉框查询载具工装信息列表
 * @param query
 * @returns {*}
 */
export function getBaseToolingInfoList (query) {
    return request({
        url: '/mes/baseToolingInfo/getBaseToolingInfoList',
        method: 'get',
        params: query
    });
};
