import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ComCurrencyVO, ComCurrencyForm, ComCurrencyQuery } from '@/api/company/comCurrency/types';

/**
 * 查询交易币别配置列表
 * @param query
 * @returns {*}
 */

export const listComCurrency = (query?: ComCurrencyQuery): AxiosPromise<ComCurrencyVO[]> => {
  return request({
    url: '/system/comCurrency/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询交易币别配置详细
 * @param id
 */
export const getComCurrency = (id: string | number): AxiosPromise<ComCurrencyVO> => {
  return request({
    url: '/system/comCurrency/' + id,
    method: 'get'
  });
};

/**
 * 新增交易币别配置
 * @param data
 */
export const addComCurrency = (data: ComCurrencyForm) => {
  return request({
    url: '/system/comCurrency',
    method: 'post',
    data: data
  });
};

/**
 * 修改交易币别配置
 * @param data
 */
export const updateComCurrency = (data: ComCurrencyForm) => {
  return request({
    url: '/system/comCurrency',
    method: 'put',
    data: data
  });
};

/**
 * 删除交易币别配置
 * @param id
 */
export const delComCurrency = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/comCurrency/' + id,
    method: 'delete'
  });
};
export function changeStatus(id: string | number, isShow: string) {
  const data = {
    id,
    isShow
  };
  return request({
    url: '/system/comCurrency/changeStatus',
    method: 'put',
    data: data
  });
}
