import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
  ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
  ROUTE_PSP_COMPANY_ROUTE_GUILDS,
  ROUTE_PSP_COMPANY_ROUTE_DEVICES,
  ROUTE_SUPER_ADMIN_COMPANY_ROUTE_GUILDS,
  ROUTE_ADMINX_COMPANY_ROUTE_GUILDS,
  ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
  ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
  ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
  ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
  ROUTE_ADMINX_ROUTE_PSP_COMPANIES,
  ROUTE_SUPER_ADMIN_ROUTE_PSP_COMPANIES,
  ROUTE_PSP_ROUTE_COMPANY_PSP_COMPANIES,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { PspOperations } from "../features/psp-company/components/psp-operations/PspOperations";
import { PspManageGuilds } from "../features/psp-company/components/psp-manage-guilds/PspManageGuilds";
import { PspActiveSession } from "../features/psp-company/components/psp-active-session/PspActiveSession";
import { PspDevices } from "../features/psp-company/components/psp-devices/PspDevices";
const PspCompanyManagement = () => {
  const { pathname } = useLocation();

  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid
          container
          direction="column"
          justifyContent="center"
          xs={12}
          sm={12}
          md={10}
          lg={10}
        >
          {[
            ROUTE_PSP_ROUTE_COMPANY_PSP_COMPANIES,
            ROUTE_SUPER_ADMIN_ROUTE_PSP_COMPANIES,
            ROUTE_ADMINX_ROUTE_PSP_COMPANIES,
          ].includes(pathname) ? (
            <Grid justifyContent="center" my={SPACING.MEDIUM}>
              <PspOperations />
            </Grid>
          ) : (
            <BackButton />
          )}

          <Grid container justifyContent="space-between" gap={SPACING.SMALL}>
            <Grid xs={12}>
              {[
                ROUTE_PSP_COMPANY_ROUTE_GUILDS,
                ROUTE_SUPER_ADMIN_COMPANY_ROUTE_GUILDS,
                ROUTE_ADMINX_COMPANY_ROUTE_GUILDS,
              ].includes(pathname) && <PspManageGuilds />}
              {[
                ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
                ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
                ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
              ].includes(pathname) && <PspActiveSession />}
              {[
                ROUTE_PSP_COMPANY_ROUTE_DEVICES,
                ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
                ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
              ].includes(pathname) && <PspDevices />}
            </Grid>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};

export default PspCompanyManagement;
