import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CurrencySettingVO, CurrencySettingForm, CurrencySettingQuery } from '@/api/system/currencySetting/types';

/**
 * 查询币种设置列表
 * @param query
 * @returns {*}
 */

export const listCurrencySetting = (query?: CurrencySettingQuery): AxiosPromise<{records: CurrencySettingVO[]}> => {
  return request({
    url: '/currency-settings-entity/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询币种设置详细
 * @param id
 */
export const getCurrencySetting = (id: string | number): AxiosPromise<CurrencySettingVO> => {
  return request({
    url: '/system/currencySetting/' + id,
    method: 'get'
  });
};

/**
 * 新增币种设置
 * @param data
 */
export const addCurrencySetting = (data: CurrencySettingForm) => {
  return request({
    url: '/currency-settings-entity/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改币种设置
 * @param data
 */
export const updateCurrencySetting = (data: CurrencySettingForm) => {
  return request({
    url: '/currency-settings-entity/add',
    method: 'post',
    data: data
  });
};

/**
 * 删除币种设置
 * @param id
 */
export const delCurrencySetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/currency-settings-entity/delete',
    method: 'post',
      data: {id: id}
  });
};
