import { Box } from "@mui/material";
import { useLocation } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { PolicyKillhouseDirectBuy } from "../features/province/components/policy-killhouse-direct-buy/PolicyKillhouseDirectBuy";
import { PolicyKillhouseGuilds } from "../features/province/components/policy-killhouse-guilds/PolicyKillhouseGuilds";
import { PolicyPoultryChooseSlaughter } from "../features/province/components/policy-poultry-choose-slaughter/PolicyPoultryChooseSlaughter";
import { PolicyPoultryFreeSale } from "../features/province/components/policy-poultry-free-sale/PolicyPoultryFreeSale";
import {
  ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
  ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_FREE_SALE,
  ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
  ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
  ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_FREE_SALE,
  ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
  ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_POULTRY_CHOOSE_SLAUGHTER,
  ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
  ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_FREE_SALE,
  ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
} from "../routes/routes";

const PolicyCouncil = () => {
  const { pathname } = useLocation();
  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid
          container
          direction="column"
          justifyContent="center"
          xs={12}
          sm={12}
          md={10}
          lg={10}
        >
          <Grid container justifyContent="space-between" gap={SPACING.SMALL}>
            <Grid mt={SPACING.SMALL} xs={12}>
              {pathname ===
                ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_POULTRY_CHOOSE_SLAUGHTER && (
                <PolicyPoultryChooseSlaughter />
              )}
              {(pathname === ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_FREE_SALE ||
                pathname === ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_FREE_SALE ||
                pathname === ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_FREE_SALE) && (
                <PolicyPoultryFreeSale />
              )}
              {(pathname === ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_DIRECT_BUY ||
                ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_DIRECT_BUY ||
                ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_DIRECT_BUY) && (
                <PolicyKillhouseDirectBuy />
              )}
              {(pathname ===
                ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS ||
                pathname ===
                  ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS ||
                pathname ===
                  ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS) && (
                <PolicyKillhouseGuilds />
              )}
            </Grid>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};

export default PolicyCouncil;
