import type { Dictionary } from "@/lib/i18n";
import type { Locale } from "@/lib/locales";
import { localizedPath } from "@/lib/routes";

export type NavigationIcon =
  | "products"
  | "solutions"
  | "about"
  | "blogs"
  | "contact"
  | "estate"
  | "builder"
  | "society"
  | "leads"
  | "reports"
  | "billing";

export type DropdownItem = {
  title: string;
  description: string;
  href: string;
  icon: NavigationIcon;
};

export type NavigationItem = {
  label: string;
  href: string;
  icon: NavigationIcon;
  dropdown?: DropdownItem[];
};

export function getNavigation(locale: Locale, dictionary: Dictionary): NavigationItem[] {
  const productBase = localizedPath(locale, "/products");
  const solutions = localizedPath(locale, "/solutions");
  return [
    {
      label: dictionary.nav.products,
      href: productBase,
      icon: "products",
      dropdown: [
        {
          title: dictionary.products.pureestate.name,
          description: dictionary.products.pureestate.short,
          href: `${productBase}/pureestate`,
          icon: "estate",
        },
        {
          title: dictionary.products.buildpro.name,
          description: dictionary.products.buildpro.short,
          href: `${productBase}/buildpro`,
          icon: "builder",
        },
        {
          title: dictionary.products.societypro.name,
          description: dictionary.products.societypro.short,
          href: `${productBase}/societypro`,
          icon: "society",
        },
      ],
    },
    {
      label: dictionary.nav.solutions,
      href: solutions,
      icon: "solutions",
      dropdown: [
        {
          title: dictionary.nav.leadManagement,
          description: dictionary.nav.leadManagementDesc,
          href: `${solutions}#lead-management`,
          icon: "leads",
        },
        {
          title: dictionary.nav.reports,
          description: dictionary.nav.reportsDesc,
          href: `${solutions}#reports`,
          icon: "reports",
        },
        {
          title: dictionary.nav.billing,
          description: dictionary.nav.billingDesc,
          href: `${solutions}#billing`,
          icon: "billing",
        },
      ],
    },
    {
      label: dictionary.nav.about,
      href: localizedPath(locale, "/about"),
      icon: "about",
    },
    {
      label: dictionary.nav.blogs,
      href: localizedPath(locale, "/blogs"),
      icon: "blogs",
    },
    {
      label: dictionary.nav.contact,
      href: localizedPath(locale, "/contact"),
      icon: "contact",
    },
  ];
}
