import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtBagVO, PtBagForm, PtBagQuery } from '@/api/payment/bag/types';


export const selectAccountBalanceByIds = (userIds: any): AxiosPromise<string> => {
  return request({
    url: '/backstage/payment/ptBag/selectAccountBalanceByIds',
    method: 'get',
    params: userIds
  });
};

/**
 * 查询账户钱包列表
 * @param query
 * @returns {*}
 */
export const listPtBag = (query?: PtBagQuery): AxiosPromise<PtBagVO[]> => {
  return request({
    url: '/backstage/payment/ptBag/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询账户钱包详细
 * @param bagId
 */
export const getPtBag = (bagId: string | number): AxiosPromise<PtBagVO> => {
  return request({
    url: '/backstage/payment/ptBag/' + bagId,
    method: 'get'
  });
};

/**
 * 新增账户钱包
 * @param data
 */
export const addPtBag = (data: PtBagForm) => {
  return request({
    url: '/backstage/payment/ptBag',
    method: 'post',
    data: data
  });
};

/**
 * 修改账户钱包
 * @param data
 */
export const updatePtBag = (data: PtBagForm) => {
  return request({
    url: '/backstage/payment/ptBag',
    method: 'put',
    data: data
  });
};

/**
 * 删除账户钱包
 * @param bagId
 */
export const delPtBag = (bagId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/payment/ptBag/' + bagId,
    method: 'delete'
  });
};
/**
 * 账户钱包充值
 * @param data
 */
export const rechargePtBag = (data: PtBagForm) => {
  return request({
    url: '/backstage/payment/ptBag/recharge',
    method: 'post',
    data: data
  });
};
/**
 * 账户钱包退款
 * @param data
 */
export const refundPtBag = (data: PtBagForm) => {
  return request({
    url: '/backstage/payment/ptBag/refund',
    method: 'post',
    data: data
  });
};
/**
 * 账户钱包批量充值
 * @param data
 * @param userIds
 */
export const batchRechargePtBag = (data: PtBagForm, userIds: Array<string | number>) => {
  return request({
    url: '/backstage/payment/ptBag/recharge/' + userIds,
    method: 'post',
    data: data
  });
};
/**
 * 账户钱包批量退款
 * @param data
 * @param userIds
 */
export const batchRefundPtBag = (data: PtBagForm, userIds: Array<string | number>) => {
  return request({
    url: '/backstage/payment/ptBag/refund/' + userIds,
    method: 'post',
    data: data
  });
};
/**
 * 账户钱包批量设置余额
 * @param data
 * @param userIds
 */
export const batchRecoverPtBag = (data: PtBagForm, userIds: Array<string | number>) => {
  return request({
    url: '/backstage/payment/ptBag/recover/' + userIds,
    method: 'post',
    data: data
  });
};
