import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtAccountVO, PtAccountForm, PtAccountQuery } from '@/api/basics/merchant/ptAccount/types';

/**
 * 查询结算账户列表
 * @param query
 * @returns {*}
 */

export const listPtAccount = (query?: PtAccountQuery): AxiosPromise<PtAccountVO[]> => {
  return request({
    url: '/backstage/merchant/ptAccount/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询结算账户详细
 * @param accountId
 */
export const getPtAccount = (accountId: string | number): AxiosPromise<PtAccountVO> => {
  return request({
    url: '/backstage/merchant/ptAccount/' + accountId,
    method: 'get'
  });
};

/**
 * 新增结算账户
 * @param data
 */
export const addPtAccount = (data: PtAccountForm) => {
  return request({
    url: '/backstage/merchant/ptAccount',
    method: 'post',
    data: data
  });
};

/**
 * 修改结算账户
 * @param data
 */
export const updatePtAccount = (data: PtAccountForm) => {
  return request({
    url: '/backstage/merchant/ptAccount',
    method: 'put',
    data: data
  });
};

/**
 * 删除结算账户
 * @param accountId
 */
export const delPtAccount = (accountId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/merchant/ptAccount/' + accountId,
    method: 'delete'
  });
};
