import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ChainCompanyActiveChains } from "../features/chain-company/components/chain-company-active-chains/ChainCompanyActiveChains";
import { useLocation } from "react-router-dom";
import {
  ROUTE_CHAIN_COMPANY_MANAGE_BARS,
  ROUTE_CHAIN_COMPANY_POULTRIES,
} from "../routes/routes";
import { ChainBarManagement } from "../features/province/components/chain-bar-management/ChainBarManagement";

const ChainCompany = () => {
  const { pathname } = useLocation();
  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid
          container
          direction="column"
          justifyContent="center"
          xs={12}
          sm={12}
          md={10}
          lg={10}
          my={SPACING.MEDIUM}
        >
          <Grid container justifyContent="space-between" gap={SPACING.SMALL}>
            <Grid xs={12}>
              {pathname === ROUTE_CHAIN_COMPANY_POULTRIES && (
                <ChainCompanyActiveChains />
              )}

              {pathname === ROUTE_CHAIN_COMPANY_MANAGE_BARS && (
                <ChainBarManagement />
              )}
            </Grid>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};

export default ChainCompany;
