import { formatStatusWithRaw } from '@/utils/admin-display'

export function formatAdminWebhookEventType(eventType: string) {
  const normalized = String(eventType || '').trim()

  if (!normalized) {
    return '-'
  }

  const labelMap: Record<string, string> = {
    payment_success: '支付成功',
    trade_create: '订单创建',
    trade_closed: '订单关闭',
    buyer_confirm_goods: '确认收货',
    auto_delivery_done: '自动发货完成',
    auto_delivery_confirmed: '自动发货确认完成',
    refund_apply: '买家申请退款',
    trade_event: '交易事件',
  }

  return formatStatusWithRaw(normalized, labelMap)
}
