import { authStore } from "@shared";
import {
  Power,
  LucideIcon,
  Building2,
  Map,
  Users,
  Earth,
  Landmark,
  GitBranch,
  // Car,
  Table,
  Notebook,
  Split,
  Newspaper,
  PersonStanding,
  Cpu,
  BookImage,
} from "lucide-react";
import { CarrierSvg } from "./CarrierSvg";

export const DRAWER_WIDTH = 300;

interface NavigationItem {
  id: string;
  label: string;
  icon?: LucideIcon | React.ReactNode;
  path?: string;
  onClick?: () => void;
  nestedItems?: NavigationItem[];
  isActive?: boolean;
}

export const NAVIGATION_ITEMS: {
  primary: NavigationItem[];
  secondary: NavigationItem[];
} = {
  primary: [
    {
      id: "all",
      label: "Все сущности",
      icon: Table,
      nestedItems: [
        {
          id: "media",
          label: "Медиа",
          icon: BookImage,
          path: "/media",
        },
        {
          id: "articles",
          label: "Статьи",
          icon: Newspaper,
          path: "/article",
        },
        {
          id: "attractions",
          label: "Достопримечательности",
          icon: Landmark,
          path: "/sight",
        },
        {
          id: "stations",
          label: "Остановки",
          icon: PersonStanding,
          path: "/station",
        },
        {
          id: "routes",
          label: "Маршруты",
          icon: Split,
          path: "/route",
        },
        {
          id: "reference",
          label: "Справочник",
          icon: Notebook,
          nestedItems: [
            {
              id: "countries",
              label: "Страны",
              icon: Earth,
              path: "/country",
            },
            {
              id: "cities",
              label: "Города",
              icon: Building2,
              path: "/city",
            },
            {
              id: "carriers",
              label: "Перевозчики",
              // @ts-ignore
              icon: CarrierSvg,
              path: "/carrier",
            },
          ],
        },
      ],
    },
    {
      id: "snapshots",
      label: "Снапшоты",
      icon: GitBranch,
      path: "/snapshot",
    },
    {
      id: "map",
      label: "Карта",
      icon: Map,
      path: "/map",
    },
    {
      id: "devices",
      label: "Устройства",
      icon: Cpu,
      path: "/devices",
    },
    // {
    //   id: "vehicles",
    //   label: "Транспорт",
    //   icon: Car,
    //   path: "/vehicle",
    // },
    {
      id: "users",
      label: "Пользователи",
      icon: Users,
      path: "/user",
    },
  ],
  secondary: [
    {
      id: "logout",
      label: "Выйти",
      icon: Power,
      onClick: () => {
        authStore.logout();
        window.location.href = "/login";
      },
    },
  ],
};

export const VEHICLE_TYPES = [
  { label: "Трамвай", value: 1 },
  { label: "Троллейбус", value: 2 },
];
