import { TFunction } from 'i18next';
import {
  FundAccountReceiveAccountNameNo,
  FundAccountResultStatus,
  FundAccountSearchCl,
  FundAccountSearchDateType,
  FundAccountStatus
} from './types';

export const getFundAccountStatusBtnGroup = (t: TFunction) => [
  { name: t('transaction.constants.all'), value: FundAccountStatus.ALL },
  { name: t('additionalService.fundAccount.registrationComplete'), value: FundAccountStatus.REGIST_COMPLETE },
  { name: t('additionalService.fundAccount.transferRequest'), value: FundAccountStatus.TRANSFER_REQUEST },
  { name: t('additionalService.fundAccount.requestSuccess'), value: FundAccountStatus.REQUEST_SUCCESS },
  { name: t('additionalService.fundAccount.requestFail'), value: FundAccountStatus.REQUEST_FAIL }
];

export const getFundAccountResultStatusBtnGroup = (t: TFunction) => [
  { name: t('transaction.constants.all'), value: FundAccountResultStatus.ALL },
  { name: t('additionalService.common.request'), value: FundAccountResultStatus.REQUEST },
  { name: t('additionalService.common.success'), value: FundAccountResultStatus.SUCCESS },
  { name: t('additionalService.common.fail'), value: FundAccountResultStatus.FAIL },

]

export const getFundAccountStatusName = (t: TFunction) => (status?: string): string => {
  if (!status) return '';
  const found = getFundAccountStatusBtnGroup(t).find(item => item.value === status);
  return found ? found.name : status;
};

export const getFundAccountResultStatusName = (t: TFunction) => (status?: string): string => {

  if (!status) return '';
  const found = getFundAccountResultStatusBtnGroup(t).find(item => item.value === status);
  return found ? found.name : status;
}

export const getFundAccountResultSearchDateTypeBtnGroup = (t: TFunction) => [
  { name: t('additionalService.fundAccount.requestDate'), value: FundAccountSearchDateType.REQUEST_DATE },
  { name: t('additionalService.fundAccount.transferDate'), value: FundAccountSearchDateType.APPLICATION_DATE }
];

export const getFundAccountSearchClOptionsGroup = (t: TFunction) => [
  { name: t('additionalService.fundAccount.recipient'), value: FundAccountSearchCl.ACCOUNT_NAME },
  { name: t('additionalService.fundAccount.accountNumber'), value: FundAccountSearchCl.ACCOUNT_NO },
];