import { TFunction } from 'i18next';
import { AlimtalkAlimCl, AlimtalkSearchCl, AlimTalkSendCl, AlimtalkSendType, ServiceCode } from "./types";

export const getAlimtalkSearchClOptionGroup = (t: TFunction) => [
    { name: t('additionalService.alimtalk.buyer'), value: AlimtalkSearchCl.BUYER_NAME },
    { name: t('transaction.constants.tid'), value: AlimtalkSearchCl.TID },
];

export const getAlimtalkServiceCodeOptionGroup = (t: TFunction) => [
    { name: t('transaction.constants.all'), value: '' },
    { name: t('transaction.constants.card'), value: ServiceCode.CARD },
    { name: t('transaction.constants.accountTransfer'), value: ServiceCode.BANK },
    { name: t('transaction.constants.virtualAccount'), value: ServiceCode.VBANK },
    { name: t('transaction.constants.mobilePhone'), value: ServiceCode.PHONE }
]

// Notification type - For Card/Account Transfer/Mobile
export const getAlimtalkAlimClBtnGroupForGeneral = (t: TFunction) => [
    { name: t('transaction.constants.all'), value: '' },
    { name: t('transaction.constants.approval'), value: AlimtalkAlimCl.APPROVAL },
    { name: t('transaction.constants.cancel'), value: AlimtalkAlimCl.CANCEL }
]

// Notification type - For Virtual Account
export const getAlimtalkAlimClBtnGroupForVBank = (t: TFunction) => [
    { name: t('transaction.constants.all'), value: '' },
    { name: t('additionalService.alimtalk.depositRequest'), value: AlimtalkAlimCl.DEPOSIT_REQUEST },
    { name: t('additionalService.alimtalk.depositComplete'), value: AlimtalkAlimCl.DEPOSIT_COMPLETE },
    { name: t('transaction.constants.refund'), value: AlimtalkAlimCl.REFUND }
]

export const getAlimtalkSendTypeBtnGroup = (t: TFunction) => [
    { name: t('transaction.constants.all'), value: AlimtalkSendType.ALL },
    { name: t('additionalService.alimtalk.kakaotalk'), value: AlimtalkSendType.KAKAOTALK },
    { name: t('additionalService.alimtalk.fbSms'), value: AlimtalkSendType.FB_SMS }
]

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

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

    const alimClMap: Record<string, string> = {
        'APPROVAL' : t('transaction.constants.approval'),
        'CANCEL' : t('transaction.constants.cancel'),
        'DEPOSIT_REQUEST' : t('additionalService.alimtalk.depositRequest'),
        'DEPOSIT_COMPLETE' : t('additionalService.alimtalk.depositComplete'),
        'REFUND' : t('transaction.constants.refund')
    }
    return alimClMap[status] || status;

}

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

    const sendTypeMap: Record<string, string> = {
        "KAKAOTALK": t('additionalService.alimtalk.kakaotalk'),
        'FB SMS': t('additionalService.alimtalk.fbSms'),
    };

    return sendTypeMap[status] || status;
}

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

    const sendClMap: Record<string, string> = {
        'REQUEST': t('additionalService.common.request'),
        'SUCCESS': t('additionalService.common.success'),
        'FAIL': t('additionalService.common.fail')
    };
    return sendClMap[status] || status;
}

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

    const serviceCodeMap: Record<string, string> = {
        'CARD': t('transaction.constants.creditCard'),
        'BANK': t('transaction.constants.accountTransfer'),
        'VBANK': t('transaction.constants.virtualAccount'),
        'PHONE': t('transaction.constants.mobilePhone')
    }

    return serviceCodeMap[status] || status;
}