import { useMyRequest } from '~/composables/useFetchRequest'

enum Api {
  OrderDetail = '/client/order/wish/detail',
  OrderList = '/client/order/wish/list/my',
  CancelOrder = '/client/order/wish/cancel',
  SubmitOrder = '/client/order/wish/submitFromCart',
  UpdateOrder = '/client/order/wish/updateOrderMd',
}

/**
 * 获取订单列表
 * @param params
 * @returns
 */
export async function getOrderListApi(params?: any) {
  return await useMyRequest().get(Api.OrderList, params)
}
/**
 * 获取订单详情
 * @param params
 * @returns
 */
export async function getOrderDetailApi(params?: any) {
  return await useMyRequest().get(Api.OrderDetail, params)
}
/**
 * 提交订单
 * @param params
 * @returns
 */
export async function submitOrderApi(params: any) {
  return await useMyRequest().post(Api.SubmitOrder, params)
}
/**
 * 取消订单
 * @param params
 * @returns
 */
export async function cancelOrderApi(params: any) {
  return await useMyRequest().post(Api.CancelOrder, params)
}
/**
 * 更新订单
 * @param params
 * @returns
 */
export async function updateOrderApi(params: any) {
  return await useMyRequest().post(Api.UpdateOrder, params)
}
