import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseMouldInfoVO, BaseMouldInfoForm, BaseMouldInfoQuery } from '@/api/mes/baseMouldInfo/types';

/**
 * 查询模具信息列表
 * @param query
 * @returns {*}
 */

export const listBaseMouldInfo = (query?: BaseMouldInfoQuery): AxiosPromise<BaseMouldInfoVO[]> => {
  return request({
    url: '/mes/baseMouldInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询模具信息详细
 * @param mouldId
 */
export const getBaseMouldInfo = (mouldId: string | number): AxiosPromise<BaseMouldInfoVO> => {
  return request({
    url: '/mes/baseMouldInfo/' + mouldId,
    method: 'get'
  });
};

/**
 * 新增模具信息
 * @param data
 */
export const addBaseMouldInfo = (data: BaseMouldInfoForm) => {
  return request({
    url: '/mes/baseMouldInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改模具信息
 * @param data
 */
export const updateBaseMouldInfo = (data: BaseMouldInfoForm) => {
  return request({
    url: '/mes/baseMouldInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除模具信息
 * @param mouldId
 */
export const delBaseMouldInfo = (mouldId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseMouldInfo/' + mouldId,
    method: 'delete'
  });
};


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