import { isNil } from 'lodash-es';

import { formatAmount } from '../../../../utils/formatting';
import { type LokaliseTFunction } from 'src/utils/i18n';

export const getTooltipLabels = (t: LokaliseTFunction) => {
  return {
    promoters: t('positives'),
    detractors: t('negatives'),
    neutrals: t('neutrals'),
  };
};

export const getCountDescription = (
  translationKey: string,
  count: number | null | undefined,
  t: LokaliseTFunction,
) =>
  t(translationKey, {
    count: isNil(count) ? 0 : count,
    value: isNil(count) ? '--' : formatAmount(count),
  });
