import request from '@/utils/request'
import type { ApiResult } from '@/api'
import type { UserWithdraw, WithdrawRequest } from './model'

/**
 * 创建用户提现申请
 * 注意：后端可能需要实现此接口
 */
export async function createUserWithdraw(data: WithdrawRequest): Promise<UserWithdraw> {
  const res = await request.post<ApiResult<UserWithdraw>>(
    '/shop/shop-user-withdraw/create',
    data
  )
  if (res.code === 0 && res.data) {
    return res.data
  }
  return Promise.reject(new Error(res.message))
}
