import React from 'react';
import VmCustom from "../_components/vm-custom";
import useGetConfig from "../_hooks/useGetConfig";
import VtxBaseModal from "../vtx-base-modal";
import { overviewApis } from "./api";
import { Overview } from "./components";
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
export var JzljYsqyContext = /*#__PURE__*/React.createContext({
  id: ''
});
var Provider = JzljYsqyContext.Provider;
export default function VtxJzljYsqyModal(props) {
  var id = props.id,
    _props$visible = props.visible,
    visible = _props$visible === void 0 ? false : _props$visible,
    onCancel = props.onCancel,
    _props$theme = props.theme,
    theme = _props$theme === void 0 ? 'light' : _props$theme,
    title = props.title,
    _props$tabChose = props.tabChose,
    tabChose = _props$tabChose === void 0 ? '' : _props$tabChose;
  var _overviewApis$useInfo = overviewApis.useInfo(id),
    _overviewApis$useInfo2 = _overviewApis$useInfo.info,
    info = _overviewApis$useInfo2 === void 0 ? {} : _overviewApis$useInfo2;
  var store = {
    theme: theme,
    id: id,
    info: info
  };
  var tabs_init = [{
    key: 'jzlj-ysqy-base',
    title: '总览信息',
    dom: /*#__PURE__*/_jsx(Overview, {})
  }];
  var tabs = tabs_init.map(function (ele) {
    return {
      key: ele.key,
      title: ele.title
    };
  });
  var contents = {};
  tabs_init.forEach(function (ele) {
    contents[ele.key] = (ele === null || ele === void 0 ? void 0 : ele.dom) || '';
  });
  var _useGetConfig = useGetConfig('jzlj-ysqy', tabs),
    tabsData = _useGetConfig.tabsData;
  // 自定义页签可配置多个，
  if (tabsData !== null && tabsData !== void 0 && tabsData.length) {
    tabsData.forEach(function (ele) {
      if (ele.url) {
        contents[ele.key] = /*#__PURE__*/_jsx(VmCustom, {
          id: id,
          url: ele === null || ele === void 0 ? void 0 : ele.url
        });
      }
    });
  }
  return /*#__PURE__*/_jsx(_Fragment, {
    children: /*#__PURE__*/_jsx(Provider, {
      value: store,
      children: /*#__PURE__*/_jsx(VtxBaseModal, {
        title: title,
        theme: theme,
        visible: visible,
        onCancel: onCancel,
        tabs: tabsData,
        tabChose: tabChose,
        contents: contents
      })
    })
  });
}