import React from 'react';
import {
  DatabaseOutlined,
  UsergroupAddOutlined,
  SettingOutlined,
  HomeOutlined,
  SolutionOutlined,
  //   AndroidOutlined,
  //   CommentOutlined,
  CopyOutlined,
} from '@ant-design/icons';
import UserLayout from '../layouts/UserLayout';
import Login from '../pages/user/login';
import BasicLayout from '../layouts/BasicLayout';
import BlankLayout from '../layouts/BlankLayout';
import Welcome from '../pages/Welcome';
import RequestTest from '../pages/testPages/request';
import InitDataBase from '../pages/database/InitDataBase';
import ManagementDataBase from '../pages/database/ManagementDataBase';
import DatabaseConnectConfig from '@/pages/database/databaseConfig/DatabaseConfig';
import CurrentSolution from '@/pages/database/CurrentSolution';
import UserManage from '../pages/userCenter/UserManage';
import RoleManage from '@/pages/userCenter/roleManage/RoleManage';
import SiteManage from '../pages/userCenter/siteManage/SiteManage';
// import DefaultComponent from '../pages/orgnazation/DefaultComponent';
import TestTable from '../pages/orgnazation/TestTable';
import WebConfigPage from '@/pages/webConfig';
import AppConfigPage from '@/pages/appConfig';
import MobileConfigPage from '@/pages/mobileConfig';
import { USER_MODE } from '@/utils/constants';
import BaseFramContainer from '@/components/BaseFramContainer';
const iconStyle = { verticalAlign: '0.125em' };

const superAuthority = [USER_MODE.SUPER];
const adminAuthority = [...superAuthority, USER_MODE.ADMIN];
// const commonAuthority = [...adminAuthority, USER_MODE.COMMON];

export default {
  routes: [
    {
      path: '/user',
      component: UserLayout,
      hideMenu: true,
      routes: [
        {
          name: 'login',
          path: '/user/login',
          component: Login,
        },
      ],
    },
    {
      path: '/test/request',
      hideMenu: true,
      component: RequestTest,
    },
    {
      path: '/',
      component: BasicLayout,
      routes: [
        {
          path: '/solution',
          name: '解决方案管理',
          icon: <SolutionOutlined style={iconStyle} />,
          authority: superAuthority,
          component: CurrentSolution,
        },
        {
          path: '/dbm',
          name: '数据库管理',
          icon: <DatabaseOutlined style={iconStyle} />,
          component: BlankLayout,
          authority: adminAuthority,
          routes: [
            // {
            //   path: '/dbm/solution',
            //   name: '数据库解决方案',
            //   authority: superAuthority,
            //   component: CurrentSolution,
            // },
            {
              path: '/dbm/dbInit',
              name: '数据库连接',
              authority: adminAuthority,
              component: InitDataBase,
            },
            {
              path: '/dbm/dbsm',
              name: '数据库标准化管理',
              authority: superAuthority,
              component: ManagementDataBase,
            },
            {
              path: '/dbm/connectConfig',
              name: '数据库连接配置',
              authority: superAuthority,
              component: DatabaseConnectConfig,
            },
          ],
        },
        {
          path: '/userCenter',
          name: '用户中心',
          component: BlankLayout,
          authority: adminAuthority,
          icon: <UsergroupAddOutlined style={iconStyle} />,
          routes: [
            {
              path: '/userCenter/UserManage',
              name: '用户管理',
              component: UserManage,
            },
            {
              path: '/userCenter/RoleManage',
              name: '角色管理',
              component: RoleManage,
            },
            {
              path: '/userCenter/SiteManage',
              name: '站点管理',
              component: SiteManage,
            },
          ],
        },
        {
          path: '/userCenter/testTable',
          name: '测试表格',
          hideMenu: true,
          component: TestTable,
        },
        {
          path: '/platformCenter',
          component: BlankLayout,
          name: '平台中心',
          icon: <SettingOutlined style={iconStyle} />,
          authority: adminAuthority,
          routes: [
            {
              path: '/platformCenter/gis',
              name: 'GIS平台',
              component: Welcome,
            },
            // {
            //   path: '/platformCenter/order',
            //   name: '工单平台',
            //   component: Welcome,
            // },
            {
              path: '/platformCenter/notify',
              name: '消息平台',
              component: BaseFramContainer,
              tabs: [
                {
                  tabName: '推送模板配置',
                  url:
                    '/web4/?widget=product/oms/MessageTem/MessageTem|hideMap=true&state=scan',
                },
                {
                  tabName: '推送方案配置',
                  url:
                    '/web4/?widget=product/oms/MessageConfig/MessageConfig|hideMap=true',
                },
              ],
            },
            {
              path: '/platformCenter/vedio',
              name: '视频管理',
              url:
                '/web4/?widget=product/oms/VideoConfig/VideoConfig|hideMap=true&videoType=萤石云',
              component: BaseFramContainer,
            },
            {
              path: '/platformCenter/emq',
              name: '宿主管理',
              url:
                '/web4/?widget=product/oms/MqttConfig/MqttConfig.js|hideMap=true',
              component: BaseFramContainer,
            },
            {
              path: '/platformCenter/dictionary',
              name: '数据字典',
              component: Welcome,
            },
          ],
        },
        {
          path: '/productCenter',
          component: BlankLayout,
          name: '应用中心',
          icon: <HomeOutlined style={iconStyle} />,
          authority: adminAuthority,
          routes: [
            {
              path: '/productCenter/web',
              name: 'web配置',
              component: WebConfigPage,
            },
            {
              path: '/productCenter/app',
              name: 'app配置',
              component: AppConfigPage,
            },
            {
              path: '/productCenter/miniProgram',
              name: '小程序配置',
              component: MobileConfigPage,
            },
          ],
        },
        {
          path: '/log',
          component: BlankLayout,
          name: '系统日志',
          icon: <CopyOutlined style={iconStyle} />,
          authority: adminAuthority,
          routes: [
            {
              path: '/log/common',
              name: '一般日志',
              icon: <CopyOutlined style={iconStyle} />,
              component: Welcome,
            },
            {
              path: '/log/service',
              name: '服务日志',
              component: Welcome,
            },
            {
              path: '/log/login',
              name: '登录日志',
              component: Welcome,
            },
            {
              path: '/log/omsOperation',
              name: '运维操作日志',
              component: Welcome,
            },
            {
              path: '/log/omsError',
              name: '运维错误日志',
              component: Welcome,
            },
          ],
        },
      ],
    },
  ],
};