/* eslint-disable react/require-default-props */
import PropTypes from 'prop-types';
import { Box, IconButton, Switch, Tooltip } from '@mui/material';
import { Icon } from '@iconify/react';
import iconArrowDownwardAltRounded from '@iconify-icons/material-symbols/arrow-downward-alt-rounded';
import iconArrowUpwardAltRounded from '@iconify-icons/material-symbols/arrow-upward-alt-rounded';
import iconDeleteRounded from '@iconify-icons/material-symbols/delete-rounded';
import iconEditRounded from '@iconify-icons/material-symbols/edit-rounded';
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function BlockletSecurityActions({
  enabled,
  showUp = true,
  showDown = true,
  showSwitch = true,
  showDelete = true,
  showEdit = true,
  disableEdit = false,
  disableSwitch = false,
  onClickUp = () => {},
  onClickDown = () => {},
  onClickSwitch = () => {},
  onClickDelete = () => {},
  onClickEdit = () => {}
}) {
  const {
    t
  } = useLocaleContext();
  return /*#__PURE__*/_jsxs(Box, {
    sx: {
      display: 'flex',
      alignItems: 'center',
      gap: 0
    },
    onClick: e => e.stopPropagation(),
    children: [showEdit ? /*#__PURE__*/_jsx(Tooltip, {
      title: t('common.edit'),
      children: /*#__PURE__*/_jsx(IconButton, {
        size: "small",
        onClick: onClickEdit,
        color: "success",
        disabled: disableEdit,
        children: /*#__PURE__*/_jsx(Icon, {
          icon: iconEditRounded,
          fontSize: 18
        })
      })
    }) : null, showDelete ? /*#__PURE__*/_jsx(Tooltip, {
      title: t('common.delete'),
      children: /*#__PURE__*/_jsx(IconButton, {
        size: "small",
        onClick: onClickDelete,
        color: "error",
        children: /*#__PURE__*/_jsx(Icon, {
          icon: iconDeleteRounded,
          fontSize: 18
        })
      })
    }) : null, showSwitch ? /*#__PURE__*/_jsx(Tooltip, {
      title: enabled ? t('common.enabled') : t('common.disabled'),
      children: /*#__PURE__*/_jsx(Switch, {
        size: "small",
        checked: enabled,
        onClick: onClickSwitch,
        disabled: disableSwitch
      })
    }) : null, showUp ? /*#__PURE__*/_jsx(Tooltip, {
      title: t('common.moveUp'),
      children: /*#__PURE__*/_jsx(IconButton, {
        size: "small",
        onClick: onClickUp,
        disabled: disableEdit,
        children: /*#__PURE__*/_jsx(Icon, {
          icon: iconArrowUpwardAltRounded,
          fontSize: 20
        })
      })
    }) : null, showDown ? /*#__PURE__*/_jsx(Tooltip, {
      title: t('common.moveDown'),
      children: /*#__PURE__*/_jsx(IconButton, {
        size: "small",
        onClick: onClickDown,
        disabled: disableEdit,
        children: /*#__PURE__*/_jsx(Icon, {
          icon: iconArrowDownwardAltRounded,
          fontSize: 20
        })
      })
    }) : null]
  });
}
BlockletSecurityActions.propTypes = {
  enabled: PropTypes.bool.isRequired,
  showUp: PropTypes.bool,
  showDown: PropTypes.bool,
  showSwitch: PropTypes.bool,
  showDelete: PropTypes.bool,
  showEdit: PropTypes.bool,
  disableEdit: PropTypes.bool,
  disableSwitch: PropTypes.bool,
  onClickUp: PropTypes.func,
  onClickDown: PropTypes.func,
  onClickSwitch: PropTypes.func,
  onClickDelete: PropTypes.func,
  onClickEdit: PropTypes.func
};