import React from 'react';
import { Box } from '@mui/material';
import { Pie } from 'react-chartjs-2';
import { registerChartJS, commonChartOptions } from './chartutils';

registerChartJS();

const PieChartComponent = () => {
  const data = {
    labels: ['SciFi', 'Drama', 'Comedy'],
    datasets: [
      {
        data: [30, 50, 20],
        backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
        borderWidth: 1,
      },
    ],
  };

  const options = {
    ...commonChartOptions,
    plugins: {
      title: {
        display: true,
        text: 'Pie Chart',
      },
    },
  };

  return (
    <Box sx={{ height: 400 }}>
      <Pie data={data} options={options} />
    </Box>
  );
};

export default PieChartComponent;