const brazilCurrency = value => {
  if (!value) return '';
  value = Number(value);

  const formattedValue = new Intl.NumberFormat('pt-BR', {
    style: 'currency',
    currency: 'BRL',
  }).format(value);

  return formattedValue;
};

const percentage = value => {
  if (!value) return '';
  value = Number(value);

  const formattedValue = new Intl.NumberFormat('pt-BR', {
    style: 'unit',
    unit: 'percent',
  }).format(value);

  return formattedValue;
};

const centimeter = value => {
  if (!value) return '';
  value = Number(value);

  const formattedValue = new Intl.NumberFormat('pt-BR').format(value);

  return formattedValue + 'cm';
};

const kilogram = value => {
  if (!value) return '';
  value = Number(value);

  const formattedValue = new Intl.NumberFormat('pt-BR').format(value);

  return formattedValue + 'kg';
};

const number = value => {
  if (!value) return '';
  value = Number(value);

  const formattedValue = new Intl.NumberFormat('pt-BR').format(value);

  return formattedValue;
};

export { brazilCurrency, percentage, centimeter, kilogram, number };
