import { getOrderStats } from '@/api/shopee/seller/order';

// TODO: Shopee Metric Order
export const fetchMetricOrderShopee = async () => {
  const result = {
    unpaid: 0,
    unprocessed: 0,
    processed: 0,
    shipping: 0,
    express: 0,
    delay: 0,
    return: 0,
    cancel: 0,
    lastest: '',
  };

  const orderStats = await getOrderStats();

  if (orderStats && orderStats.order_info) {
    result.unpaid = orderStats.order_info.unpaid;
    result.unprocessed = orderStats.order_info.toship_unprocessed;
    result.processed = orderStats.order_info.toship_processed;
    result.cancel = orderStats.order_info.request_cancellation;
    result.return = orderStats.order_info.refund_unprocessed;
  }

  result.shipping = 0;
  result.lastest = new Date();

  return result;
};
