import {
  AuditOutlined,
  BarChartOutlined,
  CloseOutlined,
  FileAddFilled,
  LogoutOutlined,
  PieChartOutlined,
  SettingFilled
} from "@ant-design/icons";
import { Menu } from "antd";
import React from "react";
import { Link, useLocation } from "react-router-dom";
import ipcTypes from "../../../ipc.types";
import SiderSignOut from "../../molecules/sider-sign-out/sider-sign-out.molecule";
const { ipcRenderer } = window;

export default function SiderMenuOrganism() {
  const { pathname } = useLocation();

  return (
    <Menu
      defaultSelectedKeys={[`/`]}
      selectedKeys={[pathname]}
      mode="inline"
      items={[
        {
          key: "/",
          icon: <PieChartOutlined />,
          label: <Link to="/">Jobs</Link>
        },
        {
          key: "/scan",
          icon: <FileAddFilled />,
          label: <Link to="/scan">File Scan</Link>
        },
        {
          key: "/reporting",
          icon: <BarChartOutlined />,
          label: <Link to="/reporting">Reporting</Link>
        },
        {
          key: "/audit",
          icon: <AuditOutlined />,
          label: <Link to="/audit">Audit</Link>
        },
        {
          key: "/settings",
          icon: <SettingFilled />,
          label: <Link to="/settings">Settings</Link>
        },
        { type: "divider" },
        {
          key: "signout",
          icon: <LogoutOutlined style={{ color: "tomato" }} />,
          label: <SiderSignOut />
        },
        {
          key: "quit",
          icon: <CloseOutlined style={{ color: "tomato" }} />,
          label: (
            <span
              onClick={() => {
                ipcRenderer.send(ipcTypes.quit);
              }}
            >
              Quit
            </span>
          )
        }
      ]}
    />
  );
}
