import { TFunction } from 'i18next';
import { FaceAuthResult, FaceAuthTransType } from "./types";

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

export const getTransactionTypeBtnGroup = (t: TFunction) => [
    { name: t('transaction.constants.all'), value: FaceAuthTransType.ALL },
    { name: t('additionalService.faceAuth.authentication'), value: FaceAuthTransType.AUTH },
    { name: t('additionalService.faceAuth.registration'), value: FaceAuthTransType.REGISTER },
];


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

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

    return authResultMap[status] || status;
}

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

    const transTypeMap: Record<string, string> = {
        'REGISTER': t('additionalService.faceAuth.registration'),
        'AUTH': t('additionalService.faceAuth.authentication')
    }

    return transTypeMap[transType] || transType;
}