import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MachineryDetailForm, MachineryDetailQuery, MachineryDetailVO } from '@/api/machinery/machineryDetail/types';

/**
 * 查询机械详情列表
 * @param query
 * @returns {*}
 */

export const listMachineryDetail = (query?: MachineryDetailQuery): AxiosPromise<MachineryDetailVO[]> => {
  return request({
    url: '/machinery/machineryDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询机械详情详细
 * @param id
 */
export const getMachineryDetail = (id: string | number): AxiosPromise<MachineryDetailVO> => {
  return request({
    url: '/machinery/machineryDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增机械详情
 * @param data
 */
export const addMachineryDetail = (data: MachineryDetailForm): AxiosPromise<string | number> => {
  return request({
    url: '/machinery/machineryDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改机械详情
 * @param data
 */
export const updateMachineryDetail = (data: MachineryDetailForm) => {
  return request({
    url: '/machinery/machineryDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除机械详情
 * @param id
 */
export const delMachineryDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/machinery/machineryDetail/' + id,
    method: 'delete'
  });
};
