import { Box, Grid } from "@mui/material";
import { BackButton } from "../components/back-button/BackButton";
import { NavLink } from "../components/nav-link/NavLink";
import LinkItem from "../components/link-item/LinkItem";
import { SPACING } from "../data/spacing";
import {
  ROUTE_SLAUGHTER_ROUTE_MANAGE_DISPENSERS,
  ROUTE_SLAUGHTER_ROUTE_MANAGE_DELEGATES,
  ROUTE_STEWARD_ROUTE_MANAGE_DELEGATES,
  ROUTE_STEWARD_ROUTE_MANAGE_DISPENSERS,
} from "../routes/routes";
import { VscPerson } from "react-icons/vsc";
import BadgeIcon from "@mui/icons-material/Badge";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";

const SlaughterSubUnits = () => {
  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid container xs={12} md={10}>
          <BackButton />
          <Grid
            container
            xs={12}
            gap={SPACING.SMALL}
            p={SPACING.SMALL}
            justifyContent="center"
          >
            <NavLink
              to={
                getRoleFromUrl() === "KillHouse"
                  ? ROUTE_SLAUGHTER_ROUTE_MANAGE_DELEGATES
                  : getRoleFromUrl() === "Steward"
                  ? ROUTE_STEWARD_ROUTE_MANAGE_DELEGATES
                  : null
              }
            >
              <LinkItem
                icon={<BadgeIcon fontSize="large" sx={{ color: "#244CCC" }} />}
                title="نمایندگان"
                description="مدیریت نمایندگان"
              />
            </NavLink>
            <NavLink
              to={
                getRoleFromUrl() === "KillHouse"
                  ? ROUTE_SLAUGHTER_ROUTE_MANAGE_DISPENSERS
                  : getRoleFromUrl() === "Steward"
                  ? ROUTE_STEWARD_ROUTE_MANAGE_DISPENSERS
                  : null
              }
            >
              <LinkItem
                icon={<VscPerson size={30} color="#244CCC" />}
                title="توزیع کنندگان"
                description="مدیریت توزیع کنندگان"
              />
            </NavLink>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};

export default SlaughterSubUnits;
