export const formatPeriod = (
  period: "DAY" | "WEEK" | "MONTH" | "YEAR" | undefined,
  interval: number
) => {
  if (!period) return `${interval} days`;
  const unit =
    period === "DAY"
      ? interval === 1
        ? "day"
        : "days"
      : period === "WEEK"
      ? interval === 1
        ? "week"
        : "weeks"
      : period === "MONTH"
      ? interval === 1
        ? "month"
        : "months"
      : interval === 1
      ? "year"
      : "years";
  return `${interval} ${unit}`;
};

export const formatPeriodHyphen = (
  period: "DAY" | "WEEK" | "MONTH" | "YEAR" | undefined,
  interval: number
) => {
  if (!period) return `${interval}-day`;
  const unit =
    period === "DAY"
      ? interval === 1
        ? "day"
        : "days"
      : period === "WEEK"
      ? interval === 1
        ? "week"
        : "weeks"
      : period === "MONTH"
      ? interval === 1
        ? "month"
        : "months"
      : interval === 1
      ? "year"
      : "years";
  return `${interval}-${unit}`;
};
