import { Box, Paper, Typography } from '@mui/material';
import Image from 'next/image';
import PropType from 'prop-types';

const DataCard = ({ data, quantity }) => {
  return (
    <Paper
      sx={{
        p: 3,
        width: '100%',
        mb: 2,
        backgroundColor: '#f2f2f2',
        display: 'flex',
      }}
      elevation={3}
    >
      <Box sx={{ width: '30%', borderRadius: 4, overflow: 'hidden' }}>
        <Image
          src="/images/coffee-mug.svg"
          alt="profile"
          width={200}
          height={250}
        />
      </Box>
      <Box
        sx={{ ml: 3, display: 'flex', flexDirection: 'column', width: '60%' }}
      >
        <Typography
          sx={{
            width: '100%',
            textAlign: 'center',
            height: 25,
            fontWeight: 600,
            fontSize: 20,
          }}
        >
          {data.name} - x{quantity}
        </Typography>
        <Typography
          sx={{
            mt: 3,
            fontSize: 14,
          }}
        >
          {data.description}
        </Typography>
        <Typography
          sx={{
            mt: 3,
            textAlign: 'right',
            fontSize: 14,
          }}
        >
          ${data.price} (per unit)
        </Typography>
      </Box>
    </Paper>
  );
};

DataCard.propTypes = {
  product: PropType.shape({
    category: PropType.string,
    name: PropType.string,
    image: PropType.string,
    description: PropType.string,
    place: PropType.string,
    people: PropType.string,
    process: PropType.string,
    pairing: PropType.string,
    available: PropType.Boolean,
    isFeatured: PropType.Boolean,
    price: PropType.number,
    customID: PropType.string,
  }),
  quantity: PropType.number,
};

export default DataCard;
