import React from 'react';
import Info2 from "../info2";
import Info1 from "./main";
import useEngineContext from "../../../hooks/useEngineContext";
import { isBooking4Shop } from "./utils";
import { Skeleton } from 'antd';
var APP = function APP(props) {
  var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5;
  var context = useEngineContext();
  var globalState = props.globalState;
  var isBooking4 = isBooking4Shop((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id, globalState === null || globalState === void 0 ? void 0 : globalState.renderType, (_context$appHelper$ut3 = context.appHelper.utils) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.businessUtils);
  if (!((_context$appHelper$ut4 = context.appHelper.utils.store) !== null && _context$appHelper$ut4 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut4.getState) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.call(_context$appHelper$ut4)) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.global) !== null && _context$appHelper$ut5 !== void 0 && (_context$appHelper$ut5 = _context$appHelper$ut5.globalConfig) !== null && _context$appHelper$ut5 !== void 0 && _context$appHelper$ut5.id)) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        padding: 16
      }
    }, /*#__PURE__*/React.createElement(Skeleton, null));
  }
  // 当满足以下条件之一时使用 Info2:
  // 1. 是 Booking4 且没有 bookingId （新建）
  // 2. 是 Booking4 且有 bookingId 且是并行资源预订 （编辑）
  if (isBooking4 && (!(globalState !== null && globalState !== void 0 && globalState.bookingId) || globalState !== null && globalState !== void 0 && globalState.isParallelResourcesBooking)) {
    return /*#__PURE__*/React.createElement(Info2, props);
  }
  return /*#__PURE__*/React.createElement(Info1, props);
};
export default APP;