import { TFunction } from 'i18next';
import { ArsPaymentMethod, OrderStatus, PaymentStatus } from './types';

export const getArsPaymentStatusBtnGroup = (t: TFunction) => [
  {name: t('transaction.constants.all'), value: PaymentStatus.ALL },
  {name: t('additionalService.ars.paymentComplete'), value: PaymentStatus.COMPLETE },
  {name: t('additionalService.ars.unpaid'), value: PaymentStatus.UNPAID }
];

export const getArsOrderStatusBtnGroup = (t: TFunction) => [
  {name: t('transaction.constants.all'), value: OrderStatus.ALL },
  {name: t('additionalService.ars.pendingPayment'), value: OrderStatus.PENDING },
  {name: t('additionalService.ars.paymentSuccess'), value: OrderStatus.SUCCESS },
  {name: t('additionalService.ars.expired'), value: OrderStatus.EXPIRED },
  {name: t('additionalService.ars.canceled'), value: OrderStatus.CANCELED },
];

export const getArsPaymentMethodBtnGroup = (t: TFunction) => [
  {name: 'SMS', value: ArsPaymentMethod.SMS },
  {name: 'ARS', value: ArsPaymentMethod.ARS },
];

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

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