import { TFunction } from 'i18next';
import { KeyInPaymentTansactionType } from "./types";

export const getKeyInPaymentPaymentStatusBtnGroup = (t: TFunction) => [
  { name: t('transaction.constants.all'), value: KeyInPaymentTansactionType.ALL },
  { name: t('transaction.constants.approval'), value: KeyInPaymentTansactionType.APPROVAL },
  { name: t('additionalService.keyIn.fullCancel'), value: KeyInPaymentTansactionType.FULL_CANCEL },
  { name: t('additionalService.keyIn.partialCancel'), value: KeyInPaymentTansactionType.PARTIAL_CANCEL }
];

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