import React from 'react';
import classNames from 'classnames';
import { Button, Icon, PisellModal } from '@pisell/materials';
/**
 * 设备手动接管确认弹窗，保持原 takeover 内容和交互不变。
 *
 * @example
 * <TakeoverModal record={device} onCancel={close} onConfirm={handleLinkDevice} />
 */
var TakeoverModal = function TakeoverModal(_ref) {
  var record = _ref.record,
    currentVariant = _ref.currentVariant,
    isPhoneVariant = _ref.isPhoneVariant,
    linkingDeviceId = _ref.linkingDeviceId,
    getText = _ref.getText,
    onCancel = _ref.onCancel,
    onConfirm = _ref.onConfirm;
  return /*#__PURE__*/React.createElement(PisellModal, {
    title: getText('pisell2.saas.device-planning.takeover.title'),
    headerDivider: false,
    footerDivider: false,
    open: Boolean(record),
    footer: /*#__PURE__*/React.createElement("div", {
      className: "saas-app-device-planning-takeover-modal__footer"
    }, /*#__PURE__*/React.createElement(Button, {
      type: "default",
      block: true,
      size: "large",
      disabled: Boolean(linkingDeviceId),
      onClick: onCancel
    }, getText('pisell2.saas.device-planning.takeover.cancel')), /*#__PURE__*/React.createElement(Button, {
      type: "primary",
      block: true,
      size: "large",
      icon: /*#__PURE__*/React.createElement(Icon, {
        type: "ThunderboltOutlined"
      }),
      loading: linkingDeviceId === (record === null || record === void 0 ? void 0 : record.id),
      disabled: Boolean(linkingDeviceId),
      onClick: function onClick() {
        return record && onConfirm(record);
      }
    }, getText('pisell2.saas.device-planning.takeover.confirm'))),
    width: 640,
    destroyOnClose: true,
    maskClosable: false,
    platform: isPhoneVariant ? 'h5' : undefined,
    mobileModalHeight: isPhoneVariant ? 'auto' : undefined,
    className: classNames('saas-app-device-planning-takeover-modal', "saas-app-device-planning-takeover-modal--".concat(currentVariant)),
    onCancel: onCancel
  }, /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__warning"
  }, /*#__PURE__*/React.createElement(Icon, {
    type: "ExclamationCircleOutlined"
  }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__message"
  }, getText('pisell2.saas.device-planning.takeover.message')), /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__detail"
  }, /*#__PURE__*/React.createElement("strong", null, getText('pisell2.saas.device-planning.takeover.device')), (record === null || record === void 0 ? void 0 : record.name) || '-'), /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__detail"
  }, /*#__PURE__*/React.createElement("strong", null, getText('pisell2.saas.device-planning.takeover.status')), getText("pisell2.saas.device-planning.status.".concat(record === null || record === void 0 ? void 0 : record.link)) || (record === null || record === void 0 ? void 0 : record.link) || '-', ' • ', getText("pisell2.saas.device-planning.status.".concat(record === null || record === void 0 ? void 0 : record.status)) || (record === null || record === void 0 ? void 0 : record.status) || '-'), /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__detail"
  }, /*#__PURE__*/React.createElement("strong", null, getText('pisell2.saas.device-planning.takeover.hardware')), (record === null || record === void 0 ? void 0 : record.modelName) || '-'), /*#__PURE__*/React.createElement("div", {
    className: "saas-app-device-planning-takeover-modal__desc"
  }, getText('pisell2.saas.device-planning.takeover.desc')))));
};
export default TakeoverModal;