import { TFunction } from 'i18next';
import { SettlementPaymentMethod, SettlementPeriodType } from './types';

export const getSettlementPeriodTypeBtnGroup = (t: TFunction) => [
  {name: t('settlement.periodType.settlementDate'), value: SettlementPeriodType.SETTLEMENT_DATE },
  {name: t('settlement.periodType.transactionDate'), value: SettlementPeriodType.TRANSACTION_DATE }
];

export const getSettlementPaymentMethodOptionsGroup = (t: TFunction) => [
  {name: t('transaction.constants.all'), value: SettlementPaymentMethod.ALL},
  {name: t('transaction.constants.creditCard'), value: SettlementPaymentMethod.CREDIT_CARD},
  {name: t('transaction.constants.virtualAccount'), value: SettlementPaymentMethod.VIRTUAL_ACCOUNT},
  {name: t('transaction.constants.accountTransfer'), value: SettlementPaymentMethod.ACCOUNT_TRANSFER},
  {name: t('transaction.constants.accountSimpleTransfer'), value: SettlementPaymentMethod.ACCOUNT_EASY_PAY},
  {name: t('transaction.constants.mobilePayment'), value: SettlementPaymentMethod.MOBILE_PAYMENT},
  {name: t('transaction.constants.ssgMoney'), value: SettlementPaymentMethod.SSG_MONEY},
  {name: t('transaction.constants.ssgBank'), value: SettlementPaymentMethod.SSG_BANK_ACCOUNT},
  {name: t('transaction.constants.cultureLand'), value: SettlementPaymentMethod.CULTURE_VOUCHER},
  {name: t('transaction.constants.tmoneyPay'), value: SettlementPaymentMethod.TMONEY_PAY},
];

export const getPaymentMethodName = (t: TFunction, paymentMethod?: string): string => {
  if (!paymentMethod) return '';

  const methodMap: Record<string, string> = {
    '신용카드': t('transaction.constants.creditCard'),
    '가상계좌': t('transaction.constants.virtualAccount'),
    '계좌이체': t('transaction.constants.accountTransfer'),
    '간편계좌이체': t('transaction.constants.accountSimpleTransfer'),
    '휴대폰': t('transaction.constants.mobilePayment'),
    'SSG머니': t('transaction.constants.ssgMoney'),
    'SSG은행계좌': t('transaction.constants.ssgBank'),
    '문화상품권': t('transaction.constants.cultureLand'),
    '티머니페이': t('transaction.constants.tmoneyPay'),
    'Credit Card': t('transaction.constants.creditCard'),
    'Virtual Account': t('transaction.constants.virtualAccount'),
    'Account Transfer': t('transaction.constants.accountTransfer'),
    'Simple Account Transfer': t('transaction.constants.accountSimpleTransfer'),
    'Mobile Payment': t('transaction.constants.mobilePayment'),
    'SSG Money': t('transaction.constants.ssgMoney'),
    'SSG Bank Account': t('transaction.constants.ssgBank'),
    'Culture Voucher': t('transaction.constants.cultureLand'),
    'Tmoney Pay': t('transaction.constants.tmoneyPay'),
  };

  return methodMap[paymentMethod] || paymentMethod;
};