import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpTokenVO, ErpTokenForm, ErpTokenQuery } from '@/api/api/erpToken/types';

/**
 * 查询ERPToken管理列表
 * @param query
 * @returns {*}
 */

export const listErpToken = (query?: ErpTokenQuery): AxiosPromise<ErpTokenVO[]> => {
  return request({
    url: '/api/erpToken/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询ERPToken管理详细
 * @param tokenId
 */
export const getErpToken = (tokenId: string | number): AxiosPromise<ErpTokenVO> => {
  return request({
    url: '/api/erpToken/' + tokenId,
    method: 'get'
  });
};

/**
 * 新增ERPToken管理
 * @param data
 */
export const addErpToken = (data: ErpTokenForm) => {
  return request({
    url: '/api/erpToken',
    method: 'post',
    data: data
  });
};

/**
 * 修改ERPToken管理
 * @param data
 */
export const updateErpToken = (data: ErpTokenForm) => {
  return request({
    url: '/api/erpToken',
    method: 'put',
    data: data
  });
};

/**
 * 删除ERPToken管理
 * @param tokenId
 */
export const delErpToken = (tokenId: string | number | Array<string | number>) => {
  return request({
    url: '/api/erpToken/' + tokenId,
    method: 'delete'
  });
};


/**
 * 下拉框查询ERPToken管理列表
 * @param query
 * @returns {*}
 */
export function getSysErpTokenList (query) {
    return request({
        url: '/api/erpToken/getSysErpTokenList',
        method: 'get',
        params: query
    });
};
