import { request } from '@/api'

// 获取用户钱包信息
export const getWalletCapital = () => {
  return request.get('/user/getWalletCapital', undefined, { showMessage: false })
}

// 获取取款渠道列表 (role_id >= 5 使用)
export const getWithdrawChannel = () => {
  return request.get('/withdraw/withdrawChannel', undefined, { showMessage: false })
}

// 获取代理取款渠道列表 (role_id < 5 使用)
export const getAgentWithdrawChannel = () => {
  return request.get('/withdraw/agentWithdrawChannel', undefined, { showMessage: false })
}

// 代理取款 (role_id < 5)
export const agentWithdraw = (params: {
  channel_id: number
  amount: string
  withdraw_fee_handle: string
  withdraw_point_diff: string
  withdraw_service_fee: string
  withdraw_head_fee: string
  withdraw_risk_fee: string
  withdraw_address: string
}) => {
  return request.post('/withdraw/agentWithdraw', params)
}

// 用户取款 (role_id >= 5)
export const withdraw = (params: {
  channel_id: number
  amount: string
  withdraw_fee_handle: string
  withdraw_point_diff: string
  withdraw_blance: string
  withdraw_address: string
  beneficiary_name: string
  beneficiary_bank_name: string
  swift_bic_code: string
  beneficiary_bank_address: string
  beneficiary_bank_account: string
}) => {
  return request.post('/withdraw/withdraw', params)
}

// 提现审核列表
export const getWithdrawReviewList = (params: {
  page: number
  page_size: number
  start_time?: string
  end_time?: string
  user_name?: string
}) => {
  return request.get('/withdraw/withdrawReviewList', params as any)
}

// 提现审核操作（通过/驳回）
export const withdrawReviewOrder = (params: { id: number; status: number }) => {
  return request.post('/withdraw/withdrawReviewOrder', params)
}

// 获取取款订单列表
export const getWithdrawOrderList = (params: {
  page: number
  page_size: number
  order_no?: string
  start_time?: string
  end_time?: string
  status?: number
  user_name?: string
}) => {
  return request.get('/withdraw/withdrawOrderList', params as any)
}