import React from 'react';
import PropTypes from 'prop-types';
import { Dot } from 'recharts';

function CustomDot({ alwaysHide = false, ...props }) {
  if (alwaysHide) {
    return null;
  }

  return props.payload?.showDot && <Dot {...props} />;
}

CustomDot.propTypes = {
  payload: PropTypes.shape({
    showDot: PropTypes.bool,
  }).isRequired,
  alwaysHide: PropTypes.bool,
};

export default CustomDot;
