import api from './request'

// 订单相关API
export const getOrders = (params) => {
  return api.get('/orders', { params })
}

export const getOrderById = (id) => {
  return api.get(`/orders/${id}`)
}

export const createOrder = (orderData) => {
  return api.post('/orders/create', orderData)
}

export const updateOrderStatus = (id, status, notes) => {
  return api.post(`/orders/${id}/status`, {
    status,
    notes
  })
}

export const cancelOrder = (id, reason) => {
  return api.post(`/orders/${id}/cancel`, {
    reason
  })
}

export const shipOrder = (id, trackingNumber) => {
  return api.post(`/orders/${id}/ship`, {
    trackingNumber
  })
}

export const completeOrder = (id) => {
  return api.post(`/orders/${id}/complete`)
}

export const createOrderPayment = (id, paymentMethod) => {
  return api.post(`/orders/${id}/pay`, {
    paymentMethod
  })
}

// 管理员订单API
export const getAdminOrders = (params) => {
  return api.get('/orders/admin', { params })
}

// 订单统计API
export const getOrderStats = () => {
  return api.get('/orders/stats')
}









