<script setup lang="ts">
import { useRouter } from 'vue-router';
import { useFullscreen } from '@vueuse/core';
import { GLOBAL_HEADER_MENU_ID } from '@/constants/app';
import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme';
import { useRouterPush } from '@/hooks/common/router';
import GlobalLogo from '../global-logo/index.vue';
import GlobalBreadcrumb from '../global-breadcrumb/index.vue';
import GlobalSearch from '../global-search/index.vue';
import ThemeButton from './components/theme-button.vue';
import UserAvatar from './components/user-avatar.vue';

defineOptions({
  name: 'GlobalHeader'
});

interface Props {
  /** Whether to show the logo */
  showLogo?: App.Global.HeaderProps['showLogo'];
  /** Whether to show the menu toggler */
  showMenuToggler?: App.Global.HeaderProps['showMenuToggler'];
  /** Whether to show the menu */
  showMenu?: App.Global.HeaderProps['showMenu'];
}

defineProps<Props>();

const appStore = useAppStore();
const themeStore = useThemeStore();
const { isFullscreen, toggle } = useFullscreen();
// const { routerPushByKey } = useRouterPush();
const router = useRouter();

function goToCesium() {
  // routerPushByKey('cesiumdeom');
  router.push('/cesiumdeom');
}
</script>

<template>
  <DarkModeContainer class="h-full flex-y-center px-12px shadow-header">
    <GlobalLogo v-if="showLogo" class="h-full" :style="{ width: themeStore.sider.width + 'px' }" />
    <MenuToggler v-if="showMenuToggler" :collapsed="appStore.siderCollapse" @click="appStore.toggleSiderCollapse" />
    <div v-if="showMenu" :id="GLOBAL_HEADER_MENU_ID" class="h-full flex-y-center flex-1-hidden"></div>
    <div v-else class="h-full flex-y-center flex-1-hidden">
      <GlobalBreadcrumb v-if="!appStore.isMobile" class="ml-12px" />
    </div>
    <div class="h-full flex-y-center justify-end">
      <NButton quaternary circle style="width: 60px" @click="toggle">
        <img src="@/assets/quanping.png" alt="" style="width: 16px; height: 16px; margin-right: 4px" />
        {{ isFullscreen ? '退出' : '全屏' }}
      </NButton>
      <NButton quaternary circle style="width: 60px" @click="goToCesium">
        <img src="@/assets/daping.png" alt="" style="width: 16px; height: 16px; margin-right: 4px" />
        大屏
      </NButton>
      <NButton quaternary circle style="width: 60px">
        <img src="@/assets/qiehuan.png" alt="" style="width: 16px; height: 16px; margin-right: 4px" />
        切换
      </NButton>
      <!--
 <NButton quaternary circle style="width: 60px" >
        <img src="@/assets/yonghu.png" alt="" style="width: 16px; height: 16px; margin-right: 4px" />
        用户
      </NButton>
-->
      <!--
 <GlobalSearch v-if="themeStore.header.globalSearch.visible" />
      <FullScreen v-if="!appStore.isMobile" :full="isFullscreen" @click="toggle" />
      <LangSwitch
        v-if="themeStore.header.multilingual.visible"
        :lang="appStore.locale"
        :lang-options="appStore.localeOptions"
        @change-lang="appStore.changeLocale"
      />
      <ThemeSchemaSwitch
        :theme-schema="themeStore.themeScheme"
        :is-dark="themeStore.darkMode"
        @switch="themeStore.toggleThemeScheme"
      />
-->
      <!-- <ThemeButton /> -->
    </div>
    <UserAvatar />
  </DarkModeContainer>
</template>

<style scoped></style>
