import { clsx, type ClassValue } from "clsx";
import type { DateRangeKey } from "@/lib/types";

export function cn(...inputs: ClassValue[]) {
  return clsx(inputs);
}

export const DATE_RANGE_LABELS: Record<DateRangeKey, string> = {
  "esta-semana": "Esta semana",
  "4-semanas": "Últimas 4 semanas",
  trimestre: "Trimestre",
};

export const ROLE_LABELS = {
  owner: "Dueño",
  leader: "Líder",
  employee: "Empleado",
} as const;

export function applyRangeMultiplier(value: number, range: DateRangeKey): number {
  if (range === "4-semanas") {
    return Math.round(value * 1.03);
  }

  if (range === "trimestre") {
    return Math.round(value * 1.11);
  }

  return value;
}

export function formatCurrencyK(value: number): string {
  return `$${value.toLocaleString("es-MX")}K`;
}

export function normalizeLocationId(label: string): string {
  return label.toLowerCase().replace(/\s+/g, "-");
}
