import React from 'react';
import { Button } from 'antd';
import { locales } from '@pisell/utils';
import "./index.less";
/**
 * 通用底部按钮组件
 * 根据step不同显示不同的按钮组
 */
var FooterButtons = function FooterButtons(_ref) {
  var step = _ref.step,
    onAppleWalletClick = _ref.onAppleWalletClick,
    onRechargeClick = _ref.onRechargeClick,
    onAddClick = _ref.onAddClick,
    _ref$disabled = _ref.disabled,
    disabled = _ref$disabled === void 0 ? false : _ref$disabled,
    _ref$platform = _ref.platform,
    platform = _ref$platform === void 0 ? 'h5' : _ref$platform,
    _ref$isIOS = _ref.isIOS,
    isIOS = _ref$isIOS === void 0 ? false : _ref$isIOS,
    _ref$addWalletLoading = _ref.addWalletLoading,
    addWalletLoading = _ref$addWalletLoading === void 0 ? false : _ref$addWalletLoading;
  // 如果是PC端，部分页面可能不需要底部按钮
  if (platform === 'pc') {
    return null; // PC端不显示底部固定按钮
  }

  // 根据不同步骤渲染不同按钮
  var renderButtons = function renderButtons() {
    switch (step) {
      case 'list':
        return /*#__PURE__*/React.createElement("div", {
          className: "wallet-footer-buttons"
        }, /*#__PURE__*/React.createElement(Button, {
          type: "primary",
          onClick: onAddClick,
          disabled: disabled,
          size: "large",
          className: "wallet-footer-buttons-item wallet-footer-buttons-item-primary"
        }, locales.getText('page.wallet.button.add')));
      case 'detail':
        // 创建按钮数组
        var buttons = [];
        // 添加到钱包按钮
        if (onAppleWalletClick) {
          buttons.push( /*#__PURE__*/React.createElement(Button, {
            loading: addWalletLoading,
            key: "apple-wallet",
            onClick: onAppleWalletClick,
            disabled: disabled,
            size: "large",
            className: "wallet-footer-buttons-item wallet-footer-buttons-item-secondary"
          }, isIOS ? locales.getText('page.wallet.button.addToAppleWallet') : locales.getText('page.wallet.button.addToGoogleWallet')));
        }

        // 充值按钮
        if (onRechargeClick) {
          buttons.push( /*#__PURE__*/React.createElement(Button, {
            key: "recharge",
            type: "primary",
            onClick: onRechargeClick,
            disabled: disabled,
            size: "large",
            className: "wallet-footer-buttons-item wallet-footer-buttons-item-primary"
          }, locales.getText('page.wallet.button.recharge')));
        }

        // 根据按钮数量设置不同的类名
        var buttonCount = buttons.length;
        var className = "wallet-footer-buttons wallet-footer-buttons-count-".concat(buttonCount);
        return buttons.length > 0 ? /*#__PURE__*/React.createElement("div", {
          className: className
        }, buttons) : null;
      default:
        return null;
    }
  };
  return /*#__PURE__*/React.createElement("div", {
    className: "wallet-footer"
  }, renderButtons());
};
export default FooterButtons;