import { TFunction } from 'i18next';

export const getPaymentStatusText = (t: TFunction) => (status?: string): string => {
  if (!status) return '';

  const statusMap: Record<string, string> = {
    // Numeric string mapping
    '0': t('additionalService.linkPay.incompleteActive'),
    '1': t('additionalService.linkPay.depositRequest'),
    '2': t('additionalService.linkPay.paymentComplete'),
    '3': t('additionalService.linkPay.paymentFail'),
    '4': t('additionalService.linkPay.paymentStopped'),
    // String key mapping (backward compatibility)
    'ALL': t('transaction.constants.all'),
    'ACTIVE': t('additionalService.linkPay.incompleteActive'),
    'DEPOSIT_REQUEST': t('additionalService.linkPay.depositRequest'),
    'PAYMENT_COMPLETE': t('additionalService.linkPay.paymentComplete'),
    'PAYMENT_FAIL': t('additionalService.linkPay.paymentFail'),
    'INACTIVE': t('additionalService.linkPay.paymentStoppedInactive')
  };

  return statusMap[status] || status;
};

export const getProcessStatusText = (t: TFunction) => (status?: string): string => {
  if (!status) return '';

  const processStatusMap: Record<string, string> = {
    'SEND_REQUEST': t('additionalService.linkPay.sendRequest'),
    'SEND_CANCEL': t('additionalService.linkPay.sendCancel'),
    'PENDING': t('additionalService.linkPay.pending')
  };

  return processStatusMap[status] || status;
};

export const getSendMethodText = (t: TFunction) => (method?: string): string => {
  if (!method) return '';

  const sendMethodMap: Record<string, string> = {
    'SMS': 'SMS',
    'EMAIL': t('additionalService.linkPay.email'),
    'KAKAO': t('additionalService.linkPay.alimtalk')
  };

  return sendMethodMap[method] || method;
};

export const getResultStatusText = (t: TFunction) => (status?: string): string => {
  if (!status) return '';

  const resultStatusMap: Record<string, string> = {
    'SUCCESS': t('additionalService.common.success'),
    'FAIL': t('additionalService.common.fail')
  };

  return resultStatusMap[status] || status;
};