import {
  Inbox,
  Star,
  Clock,
  ClockArrowUp,
  Send,
  FileText,
  ShieldAlert,
  Trash2,
  LayoutGrid,
  Newspaper,
  Rss,
  Mail,
} from "lucide-react"
import { SYSTEM_NAV_LABEL_DEFAULTS } from "@/lib/sidebar-nav-data"

export const mainItems = [
  { id: "inbox", label: "Boîte de réception", icon: Inbox },
  { id: "starred", label: "Messages suivis", icon: Star },
  { id: "snoozed", label: "En attente", icon: Clock },
  { id: "important", label: "Important", icon: "mdi:label-variant-outline" },
  { id: "sent", label: "Messages envoyés", icon: Send },
  { id: "drafts", label: "Brouillons", icon: FileText },
  { id: "scheduled", label: "Planifié", icon: ClockArrowUp },
  { id: "spam", label: "Indésirables", icon: ShieldAlert },
  { id: "trash", label: "Corbeille", icon: Trash2 },
] as const

export const CATEGORY_IDS_IN_PLUS_ONLY = new Set<string>([
  "mises-a-jour",
  "finance",
])

export const SYSTEM_NAV_LABEL_ORDER = SYSTEM_NAV_LABEL_DEFAULTS.map((r) => r.id)

export function sortSystemLabelRows(
  rows: { id: string }[]
): { id: string; label: string; icon?: string }[] {
  const copy = [...rows]
  copy.sort(
    (a, b) =>
      SYSTEM_NAV_LABEL_ORDER.indexOf(a.id) -
      SYSTEM_NAV_LABEL_ORDER.indexOf(b.id)
  )
  return copy as { id: string; label: string; icon?: string }[]
}

export const sidebarSecondaryActions = [
  { id: "customize-inbox", label: "Personnaliser la zone de réception", icon: LayoutGrid },
  { id: "manage-sections", label: "Gérer les sections", icon: Newspaper },
  { id: "manage-news", label: "Gérer les actualités", icon: Rss },
  { id: "manage-subscriptions", label: "Gérer les abonnements", icon: Mail },
] as const

export const hasPlusOnlyExtras =
  SYSTEM_NAV_LABEL_DEFAULTS.some((c) => CATEGORY_IDS_IN_PLUS_ONLY.has(c.id)) ||
  sidebarSecondaryActions.length > 0

export const LABEL_MENU_COLOR_SWATCHES = [
  "bg-gray-500",
  "bg-red-400",
  "bg-orange-400",
  "bg-amber-500",
  "bg-yellow-400",
  "bg-lime-500",
  "bg-emerald-500",
  "bg-teal-500",
  "bg-blue-500",
  "bg-indigo-500",
  "bg-purple-500",
  "bg-pink-500",
] as const

export type CategoryNavSourceItem = {
  id: string
  label: string
  icon?: string
}
