/**
 * @name 站点信息
 * 自 ONE-OS web端/加氢站管理/站点信息 独立预览
 */
import '../../common/oneosWebLegacy/legacyGlobals';
import '../../common/h2VehicleLedgerBridge.js';
import React, { useEffect, useMemo } from 'react';
import * as antd from 'antd';
import { ConfigProvider } from 'antd';
import 'antd/dist/reset.css';
import '../vehicle-management/style.css';
import '../lease-contract-management/styles/lease-contract.css';
import '../oneos-web-h2-station/styles/h2-station-vm-filter.css';
import {
  type AnnotationSourceDocument,
  type AnnotationViewerOptions
} from '@axhub/annotation';
import { PrototypeAnnotationHost } from '../../common/prototype-annotation-host';
import { clearHostPrototypeRouteInfo } from '../../common/useHashPage';
import SiteInfoPage from '../oneos-web-h2-station/pages/03-站点信息.jsx';
import annotationSourceDocument from './annotation-source.json';

/** 与租赁合同管理 / vehicle-management 主题一致 */
const vmTheme = {
  token: {
    colorPrimary: '#32a06e',
    colorLink: '#32a06e',
    colorLinkHover: '#3fb87c',
    borderRadius: 8,
    fontFamily:
      'Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif',
    fontSize: 14,
    colorText: '#18181b',
    colorTextSecondary: '#52525b',
    colorBorder: '#e5e7eb',
    colorBgContainer: '#ffffff',
  },
  components: {
    Table: {
      headerBg: '#f6f7f7',
      headerColor: '#71717a',
      rowHoverBg: '#f6f7f7',
      borderColor: '#e5e7eb',
      cellPaddingBlock: 8,
      cellPaddingInline: 12,
    },
    Card: {
      borderRadiusLG: 12,
    },
    InputNumber: {
      handleVisible: true,
    },
  },
};

window.React = React;
window.antd = antd;

export default function OneosWebH2StationSite() {
  useEffect(() => {
    clearHostPrototypeRouteInfo();
  }, []);

  const annotationOptions = useMemo<AnnotationViewerOptions>(
    () => ({
      showToolbar: true,
      showThemeToggle: true,
      showColorFilter: true,
      emptyWhenNoData: false,
      toolbarEdge: 'right',
      currentPageId: 'site-info',
    }),
    [],
  );

  return (
    <ConfigProvider theme={vmTheme}>
      <SiteInfoPage />
      <PrototypeAnnotationHost
        source={annotationSourceDocument as AnnotationSourceDocument}
        options={annotationOptions}
      />
    </ConfigProvider>
  );
}
