import request from '@/utils/request';

export function getMerchantOrders(params: any) {
  return request.get('/api/merchant/orders', { params });
}

export function getOrderDetail(orderNo: string) {
  return request.get(`/api/merchant/orders/${orderNo}`);
}

export function confirmOrder(orderNo: string) {
  return request.put(`/api/merchant/orders/${orderNo}/confirm`);
}

export function rejectOrder(orderNo: string, reason: string) {
  return request.put(`/api/merchant/orders/${orderNo}/reject`, { reason });
}

export function checkinOrder(orderNo: string) {
  return request.put(`/api/merchant/orders/${orderNo}/checkin`);
}

export function checkoutOrder(orderNo: string) {
  return request.put(`/api/merchant/orders/${orderNo}/checkout`);
}

export function exportOrders(params: any) {
  return request.get('/api/merchant/orders/export', {
    params,
    responseType: 'blob'
  });
}
