export function instanceStatusText(status?: number): string {
  if (status === undefined) return '未知'
  const map: Record<number, string> = {
    0: '待接收',
    1: '运行中',
    2: '已通过',
    3: '已拒绝',
    4: '已回退',
    5: '已完成',
    6: '已撤回',
    7: '已终止',
  }
  return map[status] || '未知'
}

export function instanceStatusTagType(status?: number): string {
  const map: Record<number, string> = {
    0: 'info',
    1: 'primary',
    2: 'success',
    3: 'danger',
    4: 'warning',
    5: 'success',
    6: 'info',
    7: 'danger',
  }
  return map[status ?? 0] || 'info'
}

export function taskStatusText(status?: number): string {
  if (status === undefined) return '未知'
  return ['待处理', '已处理', '已转办', '已跳过', '已回退'][status] || '未知'
}

export function taskStatusType(status?: number): string {
  return ['warning', 'success', 'info', 'info', 'danger'][status ?? 0] || 'info'
}

export function recordActionText(result?: string): string {
  const map: Record<string, string> = { PASS: '通过', REJECT: '拒绝', RETURN: '回退', TRANSFER: '转办' }
  return map[result || ''] || result || '-'
}

export function recordActionType(result?: string): string {
  const map: Record<string, string> = { PASS: 'success', REJECT: 'danger', RETURN: 'warning', TRANSFER: 'info' }
  return map[result || ''] || 'info'
}
