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

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

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

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

    return AuthStatusMap[status] || status;
}

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

    const AuthResultMap: Record<string, string> = {
        'MATCHED' : t('additionalService.accountHolderAuth.accountHolderNameMatch'),
        'NOT_MATCHED' : t('additionalService.accountHolderAuth.accountHolderNameMismatch'),
        'FAILED' : t('additionalService.accountHolderAuth.authFailedAccountError')
    }

    return AuthResultMap[status] || status;
}