// ** MUI Imports
import Grid from '@mui/material/Grid';
import Link from '@mui/material/Link';
import Card from '@mui/material/Card';
import Typography from '@mui/material/Typography';

// ** Demo Components Imports
import TableCategories from 'src/views/tables/TableCategories';
import { Box, Button, CardContent, Stack } from '@mui/material';
import AddCircleOutline from '@mui/icons-material/AddCircleOutline';
import { setup } from 'src/lib/csrf';

const CategoryTable = () => {
  return (
    <Grid container spacing={6}>
      <Grid item xs={12}>
        <Card>
          <Box title="Categories" titleTypographyProps={{ variant: 'h6' }}>
            <Stack m="2rem" direction="row" alignItems={'center'} justifyContent={'space-between'}>
              <Box>
                <Typography variant="h5">List Categories</Typography>
              </Box>

              <Box>
                <Link href="./add">
                  <Button variant="contained">
                    <Stack direction="row" spacing={'0.2rem'}>
                      <AddCircleOutline />
                      <Box>Add</Box>
                    </Stack>
                  </Button>
                </Link>
              </Box>
            </Stack>
          </Box>
          <CardContent>
            <TableCategories />
          </CardContent>
        </Card>
      </Grid>
    </Grid>
  );
};

export default CategoryTable;

export const getServerSideProps = setup(async ({ req, res }) => {
  return { props: {} };
});
