import {
  Bell,
  ChartColumn,
  Flag,
  LayoutDashboard,
  MessageSquareMore,
  PackageSearch,
  Settings,
  ShieldCheck,
  LifeBuoy,
  ShoppingBag,
  SquareKanban,
  Users,
  type LucideIcon,
} from "lucide-react";

import type { PermissionMatchMode } from "@/lib/permissions";
import { SUPERADMIN_PERMISSIONS } from "@/lib/permissions";

export type DashboardNavItem = {
  href: string;
  label: string;
  icon: LucideIcon;
  permissionMode?: PermissionMatchMode;
  requiredPermissions: readonly string[];
};

export const dashboardNav = [
  {
    href: "/dashboard",
    label: "Dashboard",
    icon: LayoutDashboard,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.OVERVIEW_READ],
  },
  {
    href: "/users",
    label: "Users",
    icon: Users,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.USERS_READ],
  },
  {
    href: "/analytics",
    label: "Analytics",
    icon: ChartColumn,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.ANALYTICS_READ],
  },
  {
    href: "/content",
    label: "Content",
    icon: SquareKanban,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.CONTENT_MODERATE],
  },
  {
    href: "/reports",
    label: "Reports",
    icon: Flag,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.CONTENT_MODERATE],
  },
  {
    href: "/dashboard/support",
    label: "Support",
    icon: LifeBuoy,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.CASES_MANAGE],
  },
  {
    href: "/marketplace",
    label: "Marketplace",
    icon: ShoppingBag,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.MARKETPLACE_MANAGE],
  },
  {
    href: "/notifications",
    label: "Notifications",
    icon: Bell,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.NOTIFICATIONS_READ],
  },
  {
    href: "/messages",
    label: "Engagement",
    icon: MessageSquareMore,
    permissionMode: "any",
    requiredPermissions: [
      SUPERADMIN_PERMISSIONS.NOTIFICATIONS_READ,
      SUPERADMIN_PERMISSIONS.CONTENT_MODERATE,
    ],
  },
  {
    href: "/orders",
    label: "Operations",
    icon: PackageSearch,
    permissionMode: "any",
    requiredPermissions: [
      SUPERADMIN_PERMISSIONS.CASES_MANAGE,
      SUPERADMIN_PERMISSIONS.OPS_READ,
    ],
  },
  {
    href: "/security",
    label: "Security",
    icon: ShieldCheck,
    permissionMode: "any",
    requiredPermissions: [
      SUPERADMIN_PERMISSIONS.SESSIONS_MANAGE,
      SUPERADMIN_PERMISSIONS.AUDIT_READ,
      SUPERADMIN_PERMISSIONS.OPS_READ,
    ],
  },
  {
    href: "/settings",
    label: "Settings",
    icon: Settings,
    requiredPermissions: [SUPERADMIN_PERMISSIONS.SETTINGS_READ],
  },
] satisfies readonly DashboardNavItem[];
