import {
  BadgeCheck,
  BarChart3,
  Building2,
  ChartNoAxesCombined,
  ClipboardCheck,
  ClipboardList,
  Construction,
  Headphones,
  Home,
  Lock,
  MessageSquareWarning,
  RefreshCw,
  Settings2,
  ShieldCheck,
  UserRoundCheck,
  Users,
  WalletCards,
  Wrench,
} from "lucide-react";

import type { Dictionary } from "@/lib/i18n";

export type Tone = "violet" | "blue" | "green" | "orange" | "rose";

const featureVisuals = [
  [UserRoundCheck, "violet"],
  [Building2, "violet"],
  [ClipboardList, "blue"],
  [WalletCards, "blue"],
  [Users, "violet"],
  [Home, "green"],
  [Wrench, "green"],
  [MessageSquareWarning, "rose"],
  [BarChart3, "green"],
] as const;

const audienceVisuals = [
  [Construction, "orange"],
  [Users, "orange"],
  [Building2, "violet"],
  [ChartNoAxesCombined, "blue"],
  [Home, "violet"],
  [Settings2, "green"],
] as const;

const trustVisuals = [
  [BadgeCheck, "green"],
  [Headphones, "orange"],
  [ShieldCheck, "blue"],
  [RefreshCw, "violet"],
] as const;

export function getHomeData(dictionary: Dictionary) {
  return {
    features: dictionary.features.map(([title, desc], index) => ({
      title,
      desc,
      icon: featureVisuals[index]?.[0] ?? ClipboardCheck,
      tone: featureVisuals[index]?.[1] ?? "violet",
    })),
    audiences: dictionary.audiences.map(([title, desc], index) => ({
      title,
      desc,
      icon: audienceVisuals[index]?.[0] ?? Users,
      tone: audienceVisuals[index]?.[1] ?? "blue",
    })),
    trustCards: dictionary.trust.map(([title, desc], index) => ({
      title,
      desc,
      icon: trustVisuals[index]?.[0] ?? Lock,
      tone: trustVisuals[index]?.[1] ?? "violet",
    })),
    testimonials: dictionary.testimonials.map(([name = "", role = "", text = ""], index) => ({
      name,
      role,
      text,
      initials: name
        .split(" ")
        .map((part) => part[0])
        .join("")
        .slice(0, 2),
      gradient: [
        "from-amber-100 to-orange-300",
        "from-rose-100 to-violet-300",
        "from-cyan-100 to-blue-300",
      ][index],
    })),
  };
}

export const trustPills = [
  { label: "Unified Platform", icon: ClipboardCheck, tone: "violet" as Tone },
  { label: "Real-time Insights", icon: ChartNoAxesCombined, tone: "green" as Tone },
  { label: "Secure & Reliable", icon: Lock, tone: "violet" as Tone },
  { label: "Scalable & Flexible", icon: RefreshCw, tone: "blue" as Tone },
];
