import React from 'react';
import { Alert } from 'antd';
import { PisellModal } from '@pisell/materials';
import { ExclamationCircleFilled } from '@ant-design/icons';
import { formatToken } from "../../constants";
var DeleteDeviceModal = function DeleteDeviceModal(_ref) {
  var open = _ref.open,
    record = _ref.record,
    submitting = _ref.submitting,
    getText = _ref.getText,
    onCancel = _ref.onCancel,
    onConfirm = _ref.onConfirm;
  var online = (record === null || record === void 0 ? void 0 : record.status) === 'online';
  var name = (record === null || record === void 0 ? void 0 : record.name) || '';
  return /*#__PURE__*/React.createElement(PisellModal, {
    open: open,
    title: getText('pisell2.saas.device-planning.delete-device.title'),
    headerDivider: false,
    onCancel: onCancel,
    okText: getText(online ? 'pisell2.saas.device-planning.delete-device.delete-anyway' : 'pisell2.saas.device-planning.detail.delete'),
    cancelText: getText('pisell2.saas.device-planning.detail.cancel'),
    okButtonProps: {
      danger: true,
      loading: submitting,
      onClick: onConfirm
    },
    cancelButtonProps: {
      disabled: submitting
    },
    destroyOnClose: true,
    maskClosable: false,
    width: 460,
    bodyStyle: {
      padding: '0 24px 24px'
    }
  }, online ? /*#__PURE__*/React.createElement(Alert, {
    type: "warning",
    showIcon: true,
    icon: /*#__PURE__*/React.createElement(ExclamationCircleFilled, null),
    message: getText('pisell2.saas.device-planning.delete-device.online-title'),
    description: formatToken(getText('pisell2.saas.device-planning.delete-device.online-desc'), {
      DeviceName: name
    })
  }) : /*#__PURE__*/React.createElement("div", null, formatToken(getText('pisell2.saas.device-planning.delete-device.confirm'), {
    DeviceName: name
  })));
};
export default DeleteDeviceModal;