import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WithdrawalOrdersVO, WithdrawalOrdersForm, WithdrawalOrdersQuery } from '@/api/agent/withdrawalOrders/types';

/**
 * 查询提现申请记录列表
 * @param query
 * @returns {*}
 */

export const listWithdrawalOrders = (query?: WithdrawalOrdersQuery): AxiosPromise<WithdrawalOrdersVO[]> => {
  return request({
    url: '/order/withdrawalOrders/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询提现申请记录详细
 * @param id
 */
export const getWithdrawalOrders = (id: string | number): AxiosPromise<WithdrawalOrdersVO> => {
  return request({
    url: '/order/withdrawalOrders/' + id,
    method: 'get'
  });
};

/**
 * 新增提现申请记录
 * @param data
 */
export const addWithdrawalOrders = (data: WithdrawalOrdersForm) => {
  return request({
    url: '/order/withdrawalOrders',
    method: 'post',
    data: data
  });
};

/**
 * 修改提现申请记录
 * @param data
 */
export const updateWithdrawalOrders = (data: WithdrawalOrdersForm) => {
  return request({
    url: '/order/withdrawalOrders',
    method: 'put',
    data: data
  });
};

/**
 * 修改代理提现订单状态
 * @param data
 */
export const changeOrderStatus = (data: WithdrawalOrdersForm) => {
  return request({
    url: '/order/withdrawalOrders/changeOrderStatus',
    method: 'put',
    data: data
  });
};

/**
 * 删除提现申请记录
 * @param id
 */
export const delWithdrawalOrders = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/withdrawalOrders/' + id,
    method: 'delete'
  });
};
