import PropTypes from 'prop-types';
import { Box, Tooltip, Typography } from '@mui/material';
import { sendStatusColor } from './utils';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
export default function StatusDot({
  config,
  enableTooltip = true,
  showTitle = false,
  children = null
}) {
  const {
    status,
    title = '',
    sentTime = '',
    reason = ''
  } = config;
  const tips = [title, reason].filter(Boolean).join(', ');
  return /*#__PURE__*/_jsx(Tooltip, {
    title: enableTooltip ? /*#__PURE__*/_jsxs(_Fragment, {
      children: [/*#__PURE__*/_jsx(Typography, {
        color: "inherit",
        sx: {
          fontSize: 12
        },
        children: tips
      }), /*#__PURE__*/_jsx("span", {
        children: sentTime
      })]
    }) : null,
    arrow: true,
    placement: "top",
    children: /*#__PURE__*/_jsxs(Box, {
      sx: {
        display: 'flex',
        flexDirection: 'row',
        alignItems: 'center',
        gap: '4px'
      },
      children: [/*#__PURE__*/_jsxs(Box, {
        sx: {
          position: 'relative',
          minHeight: 14,
          minWidth: 14,
          display: 'flex',
          alignItems: 'center',
          justifyContent: 'center'
        },
        children: [/*#__PURE__*/_jsx(Box, {
          style: {
            opacity: 0.15
          },
          sx: {
            position: 'absolute',
            width: '100%',
            height: '100%',
            borderRadius: '50%',
            bgcolor: sendStatusColor[status]
          }
        }), /*#__PURE__*/_jsx(Box, {
          sx: {
            position: 'absolute',
            width: '55%',
            height: '55%',
            borderRadius: '50%',
            bgcolor: sendStatusColor[status]
          }
        })]
      }), /*#__PURE__*/_jsx(Typography, {
        color: "inherit",
        sx: {
          fontSize: 12
        },
        children: showTitle ? title : children
      })]
    })
  });
}
StatusDot.propTypes = {
  config: PropTypes.object.isRequired,
  enableTooltip: PropTypes.bool,
  showTitle: PropTypes.bool,
  children: PropTypes.node
};