import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseStationInfoVO, BaseStationInfoForm, BaseStationInfoQuery } from '@/api/mes/baseStationInfo/types';

/**
 * 查询工位信息列表
 * @param query
 * @returns {*}
 */

export const listBaseStationInfo = (query?: BaseStationInfoQuery): AxiosPromise<BaseStationInfoVO[]> => {
  return request({
    url: '/mes/baseStationInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工位信息详细
 * @param stationId
 */
export const getBaseStationInfo = (stationId: string | number): AxiosPromise<BaseStationInfoVO> => {
  return request({
    url: '/mes/baseStationInfo/' + stationId,
    method: 'get'
  });
};

/**
 * 新增工位信息
 * @param data
 */
export const addBaseStationInfo = (data: BaseStationInfoForm) => {
  return request({
    url: '/mes/baseStationInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改工位信息
 * @param data
 */
export const updateBaseStationInfo = (data: BaseStationInfoForm) => {
  return request({
    url: '/mes/baseStationInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除工位信息
 * @param stationId
 */
export const delBaseStationInfo = (stationId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseStationInfo/' + stationId,
    method: 'delete'
  });
};

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