export type ApprovalSource = 'none' | 'legacy' | 'wecom'

export interface ApprovalSummary {
  approval_source?: ApprovalSource | null
  approval_status_name?: string | null
  current_approver_summary?: string | null
  processing_status_name?: string | null
}

export const getApprovalStatusText = (summary: ApprovalSummary): string => {
  if (summary.approval_source === 'legacy') return '历史审批'
  if (summary.approval_source === 'wecom') return summary.approval_status_name || '-'
  return '-'
}

export const getCurrentApproverSummaryText = (summary: ApprovalSummary): string => {
  if (summary.approval_source !== 'wecom') return '-'
  return summary.current_approver_summary || '-'
}

export const getProcessingStatusText = (summary: ApprovalSummary): string =>
  summary.processing_status_name || '-'
