import type { BadgeProps } from 'antd';

export enum OrderStatus {
  All = 0,
  PendingPayment = 10,
  PendingConfirmation = 20,
  PendingService = 30,
  PendingAcceptance = 40,
  Completed = 50,
  Cancelled = 60,
  Refunded = 70,
}

export const OrderBtnLableMap: Record<OrderStatus, string> = {
  [OrderStatus.PendingPayment]: '取消订单',
  [OrderStatus.PendingConfirmation]: '接单确定',
  [OrderStatus.PendingService]: '准备完成 开始服务',
  [OrderStatus.PendingAcceptance]: '服务完成上报',
  [OrderStatus.All]: '',
  [OrderStatus.Completed]: '',
  [OrderStatus.Cancelled]: '',
  [OrderStatus.Refunded]: '',
};

// 状态标签映射
export const OrderStatusLabels: Record<
  OrderStatus,
  { label: string; color: string }
> = {
  [OrderStatus.All]: { label: '所有订单', color: 'default' },
  [OrderStatus.PendingPayment]: { label: '等待付款', color: 'danger' },
  [OrderStatus.PendingConfirmation]: { label: '等待确定', color: 'warning' },
  [OrderStatus.PendingService]: { label: '等待服务', color: 'primary' },
  [OrderStatus.PendingAcceptance]: { label: '等待验收', color: 'success' },
  [OrderStatus.Completed]: { label: '已完成', color: 'secondary' },
  [OrderStatus.Cancelled]: { label: '已取消', color: 'secondary' },
  [OrderStatus.Refunded]: { label: '已退款', color: 'secondary' },
};

export const mapOrderStatusToBadgeStatus = (
  statusColor: string,
): BadgeProps['status'] => {
  const statusMap: Record<string, BadgeProps['status']> = {
    success: 'success',
    processing: 'processing',
    default: 'default',
    error: 'error',
    warning: 'warning',
    primary: 'processing',
    danger: 'error',
    secondary: 'default',
  };

  return statusMap[statusColor] || 'default';
};

export enum SalesStatus {
  All = 0,
  Apply = 10,
  SellerAgree = 20,
  BuyerDelivery = 30,
  WaitRefund = 40,
  Completed = 50,
}

export const SalesStatusLableMap: Record<SalesStatus, string> = {
  [SalesStatus.All]: '所有售后单',
  [SalesStatus.Apply]: '等待审核',
  [SalesStatus.SellerAgree]: '审核通过',
  [SalesStatus.BuyerDelivery]: '已完成',
  [SalesStatus.WaitRefund]: '已取消',
  [SalesStatus.Completed]: '已拒绝',
};
