import React from "react";
import { useLocation } from "react-router-dom";
import { Grid } from "../../../../components/grid/Grid";
import { SPACING } from "../../../../data/spacing";
import LinkItem from "../../../../components/link-item/LinkItem";
import {
  VscPieChart,
  VscGraph,
  VscGraphLine,
  VscRunAll,
} from "react-icons/vsc";
import { NavLink } from "../../../../components/nav-link/NavLink";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
import {
  ROUTE_ADMIN_NATIONAL_STATICS,
  ROUTE_ADMIN_STATICS,
  ROUTE_ADMINX_NATIONAL_STATICS,
  ROUTE_ADMINX_STATICS,
  ROUTE_ADMINX_VISOR_STATICS_CHARTS,
  ROUTE_ADMINX_VISOR_STATICS_PREDICTION,
  ROUTE_CITY_POULTRY_STATICS,
  ROUTE_CITY_STATICS,
  ROUTE_CITY_VISOR_STATICS_CHARTS,
  ROUTE_CITY_VISOR_STATICS_PREDICTION,
  ROUTE_COMMERCE_STATICS,
  ROUTE_COMMERCE_VISOR_STATICS_CHARTS,
  ROUTE_COMMERCE_VISOR_STATICS_PREDICTION,
  ROUTE_INSPECTOR_STATICS,
  ROUTE_JAHAD_KILLS_STATS,
  ROUTE_OBSERVATORY_VISOR_STATICS_CHARTS,
  ROUTE_OBSERVATORY_VISOR_STATICS_PREDICTION,
  ROUTE_PROVINCE_FINANCIAL_STATICS,
  ROUTE_PROVINCE_NATIONAL_STATICS,
  ROUTE_PROVINCE_STATICS,
  ROUTE_PROVINCE_SUPERVISOR_STATICS_CHARTS,
  ROUTE_PROVINCE_SUPERVISOR_STATICS_PREDICTION,
  ROUTE_PROVINCEـVISOR_STATICS_CHARTS,
  ROUTE_PROVINCEـVISOR_STATICS_PREDICTION,
  ROUTE_SUPER_ADMIN_NATIONAL_STATICS,
  ROUTE_SUPER_ADMIN_STATICS,
  ROUTE_SUPER_ADMIN_VISOR_STATICS_CHARTS,
  ROUTE_SUPER_ADMIN_VISOR_STATICS_PREDICTION,
  ROUTE_VETـSUPERVISOR_STATICS,
  ROUTE_VETـSUPERVISOR_STATICS_CHARTS,
  ROUTE_VETـSUPERVISOR_STATICS_PREDICTION,
} from "../../../../routes/routes";

export const VisorsStaticsOperations = () => {
  const { pathname } = useLocation();

  return (
    <Grid
      container
      gap={SPACING.SMALL}
      p={SPACING.SMALL}
      direction={{ xs: "column", md: "row" }}
      justifyContent="center"
      style={{ placeContent: "baseline" }}
    >
      <Grid container direction="column" style={{ width: "100%" }}>
        <Grid container gap={SPACING.SMALL} justifyContent="center">
          <NavLink
            to={
              getRoleFromUrl() === "AdminX"
                ? ROUTE_ADMINX_VISOR_STATICS_CHARTS
                : getRoleFromUrl() === "SuperAdmin"
                ? ROUTE_SUPER_ADMIN_VISOR_STATICS_CHARTS
                : getRoleFromUrl() === "CityOperator"
                ? ROUTE_CITY_VISOR_STATICS_CHARTS
                : getRoleFromUrl() === "ProvinceOperator"
                ? ROUTE_PROVINCEـVISOR_STATICS_CHARTS
                : getRoleFromUrl() === "VetSupervisor"
                ? ROUTE_VETـSUPERVISOR_STATICS_CHARTS
                : getRoleFromUrl() === "Commerce"
                ? ROUTE_COMMERCE_VISOR_STATICS_CHARTS
                : getRoleFromUrl() === "ProvinceSupervisor"
                ? ROUTE_PROVINCE_SUPERVISOR_STATICS_CHARTS
                : getRoleFromUrl() === "Observatory"
                ? ROUTE_OBSERVATORY_VISOR_STATICS_CHARTS
                : ROUTE_ADMINX_VISOR_STATICS_CHARTS
            }
            active={
              pathname === ROUTE_ADMINX_VISOR_STATICS_CHARTS ? "true" : null
            }
          >
            <LinkItem
              icon={<VscGraph size={30} color="#244CCC" />}
              title="پایش آمار کشتار"
              description="پایش آمار کشتار"
            />
          </NavLink>

          <NavLink
            to={
              getRoleFromUrl() === "AdminX"
                ? ROUTE_ADMINX_VISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "SuperAdmin"
                ? ROUTE_SUPER_ADMIN_VISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "CityOperator"
                ? ROUTE_CITY_VISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "ProvinceOperator"
                ? ROUTE_PROVINCEـVISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "VetSupervisor"
                ? ROUTE_VETـSUPERVISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "Commerce"
                ? ROUTE_COMMERCE_VISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "ProvinceSupervisor"
                ? ROUTE_PROVINCE_SUPERVISOR_STATICS_PREDICTION
                : getRoleFromUrl() === "Observatory"
                ? ROUTE_OBSERVATORY_VISOR_STATICS_PREDICTION
                : ROUTE_ADMINX_VISOR_STATICS_PREDICTION
            }
            active={
              pathname === ROUTE_ADMINX_VISOR_STATICS_PREDICTION ? "true" : null
            }
          >
            <LinkItem
              icon={<VscPieChart size={30} color="#244CCC" />}
              title="پیش بینی موجودی"
              description="پیش بینی موجودی"
            />
          </NavLink>

          <NavLink
            to={
              getRoleFromUrl() === "AdminX"
                ? ROUTE_ADMINX_STATICS
                : getRoleFromUrl() === "SuperAdmin"
                ? ROUTE_SUPER_ADMIN_STATICS
                : getRoleFromUrl() === "Admin"
                ? ROUTE_ADMIN_STATICS
                : getRoleFromUrl() === "CityOperator"
                ? ROUTE_CITY_STATICS
                : getRoleFromUrl() === "ProvinceOperator"
                ? ROUTE_PROVINCE_STATICS
                : getRoleFromUrl() === "ProvinceFinancial"
                ? ROUTE_PROVINCE_FINANCIAL_STATICS
                : getRoleFromUrl() === "VetSupervisor"
                ? ROUTE_VETـSUPERVISOR_STATICS
                : getRoleFromUrl() === "ProvinceInspector"
                ? ROUTE_INSPECTOR_STATICS
                : getRoleFromUrl() === "Jahad"
                ? ROUTE_JAHAD_KILLS_STATS
                : getRoleFromUrl() === "Commerce"
                ? ROUTE_COMMERCE_STATICS
                : ROUTE_CITY_POULTRY_STATICS
            }
            active={pathname === ROUTE_ADMINX_STATICS ? "true" : null}
          >
            <LinkItem
              icon={<VscGraphLine size={30} color="#244CCC" />}
              title="آمار و اطلاعات"
              description="آمار و اطلاعات"
            />
          </NavLink>

          <NavLink
            to={
              getRoleFromUrl() === "AdminX"
                ? ROUTE_ADMINX_NATIONAL_STATICS
                : getRoleFromUrl() === "SuperAdmin"
                ? ROUTE_SUPER_ADMIN_NATIONAL_STATICS
                : getRoleFromUrl() === "Admin"
                ? ROUTE_ADMIN_NATIONAL_STATICS
                : getRoleFromUrl() === "ProvinceOperator"
                ? ROUTE_PROVINCE_NATIONAL_STATICS
                : ROUTE_ADMINX_NATIONAL_STATICS
            }
            active={pathname === ROUTE_ADMINX_NATIONAL_STATICS ? "true" : null}
          >
            <LinkItem
              icon={<VscRunAll size={30} color="#244CCC" />}
              title="پایش کشوری"
              description="پایش کشوری"
            />
          </NavLink>
        </Grid>
      </Grid>
    </Grid>
  );
};
