import {
  Download,
  //Calendar,
  FileText,
  //Home,
  //Inbox,
  LayoutGrid,
  //Search,
  SquareCheck,
  Upload,
  //Settings,
  Users,
} from "lucide-react";
import { NavOptions } from "./navigationtabs";
import { useTranslation } from "react-i18next";
import { t } from "i18next";

// Management section items
export const managementItems: NavOptions[] = [
  {
    title: t("Record Management") || "Record Management",
    url: "/record-management/userRecords",
    icon: FileText,
    isActive: true,
  },
  {
    title: t("User Management") || "User Management",
    url: "/user-management",
    icon: Users,
    perms: ["view:user-management", "manage:users"],
    roles: ["super_admin", "admin", "unit_admin"],
  },
  // {
  //   title: t("Workflow Management"),
  //   url: "workflowManagement",
  //   icon: GitBranch,
  // },
  // {
  //   title: t("Project Management"),
  //   url: "projectManagement",
  //   icon: Briefcase,
  // },
  // {
  //   title: t("Document Management"),
  //   url: "documentManagement",
  //   icon: FileArchive,
  // },
  // {
  //   title: t("Knowledge & Asset Management"),
  //   url: "knowledgeManagement",
  //   icon: BookOpen,
  // },
  // {
  //   title: t("Report Management"),
  //   url: "reportManagement",
  //   icon: BarChart3,
  // },
];

export const useNavItems = (permissions: string[]): NavOptions[] => {
  const { t } = useTranslation();

  // Main navigation items based on the image
  const mainNavItems: NavOptions[] = [
    {
      title: t("nav.dashboard"),
      url: "dashboard",
      isActive: true,
      icon: LayoutGrid,
    },
  ];

  const userNavs: NavOptions[] = [
    {
      title: t("nav.dashboard"),
      url: "dashboard",
      isActive: true,
      icon: LayoutGrid,
    },
    {
      title: t("nav.outgoing"),
      url: "userRecords",
      icon: Upload,
    },
    {
      title: t("nav.incoming"),
      url: "userIncoming",
      icon: Download,
      count: true,
      items: [
        {
          title: t("nav.external"),
          url: "userIncoming",
          count: true,
        },
        {
          title: t("nav.internal"),
          url: "userIncoming/internal",
          count: true,
        },
        {
          title: t("nav.cc"),
          url: "userIncoming/cc",
          count: true,
        },
      ],
    },
  ];
  const approvalPermissionKeys = ["can:sendToRO", "can:approveRecords"];
  if (approvalPermissionKeys.some((key) => permissions.includes(key))) {
    userNavs.push({
      title: t("nav.approval"),
      url: "approval",
      icon: SquareCheck,
      count: true,
      items: [],
    });
  }

  return [...mainNavItems, ...managementItems];
};
