import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtWorkstationVO, PtWorkstationForm, PtWorkstationQuery } from '@/api/basics/basicParameter/ptWorkstation/types';

/**
 * 查询工作站列表
 * @param query
 * @returns {*}
 */
export const listPtWorkstation = (query?: PtWorkstationQuery): AxiosPromise<PtWorkstationVO[]> => {
  return request({
    url: '/backstage/basicParameter/ptWorkstation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作站详细
 * @param stationId
 */
export const getPtWorkstation = (stationId: string | number): AxiosPromise<PtWorkstationVO> => {
  return request({
    url: '/backstage/basicParameter/ptWorkstation/' + stationId,
    method: 'get'
  });
};

/**
 * 新增工作站
 * @param data
 */
export const addPtWorkstation = (data: PtWorkstationForm) => {
  return request({
    url: '/backstage/basicParameter/ptWorkstation',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作站
 * @param data
 */
export const updatePtWorkstation = (data: PtWorkstationForm) => {
  return request({
    url: '/backstage/basicParameter/ptWorkstation',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作站
 * @param stationId
 */
export const delPtWorkstation = (stationId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/basicParameter/ptWorkstation/' + stationId,
    method: 'delete'
  });
};
