<template>
  <q-layout view="lHh Lpr lFf">
    <q-header elevated>
      <q-toolbar>
        <q-btn
          flat
          dense
          round
          icon="menu"
          aria-label="Menu"
          @click="toggleLeftDrawer"
        />
        <q-toolbar-title>
          {{ productName }}
          <q-badge align="top" outline>V{{ version }}</q-badge>
        </q-toolbar-title>
        <domain-selector></domain-selector>
        <q-btn flat round dense icon="logout" @click="authStore.logout()"/>
      </q-toolbar>
    </q-header>

    <q-drawer
      :model-value="authStore.toggleLeftDrawer"
      :show-if-above="false"
      bordered
    >
      <q-list>
        <q-item-label
          header
        >
          関連リンク
        </q-item-label>

        <EssentialLink
          v-for="link in essentialLinks"
          :key="link.title"
          v-bind="link"
        />
      </q-list>
    </q-drawer>

    <q-page-container>
      <router-view />
    </q-page-container>
  </q-layout>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import EssentialLink, { EssentialLinkProps } from 'components/EssentialLink.vue';
import DomainSelector from 'components/DomainSelector.vue';
import { useAuthStore } from 'stores/useAuthStore';

const authStore = useAuthStore();

const essentialLinks: EssentialLinkProps[] = [
{
    title: 'ホーム',
    caption: 'home',
    icon: 'home',
    link: '/',
    target:'_self'
  },
  {
    title: 'フローエディター',
    caption: 'flowChart',
    icon: 'account_tree',
    link: '/#/FlowChart',
    target:'_self'
  },
  // {
  //   title: '条件エディター',
  //   caption: 'condition',
  //   icon: 'tune',
  //   link: '/#/condition',
  //   target:'_self'
  // },
  {
    title:'',
    isSeparator:true
  },
  // {
  //   title:'Kintone ポータル',
  //   caption:'Kintone',
  //   icon:'cloud_queue',
  //   link:'https://mfu07rkgnb7c.cybozu.com/k/#/portal'
  // },
  // {
  //   title:'CUSTOMINE',
  //   caption:'gusuku',
  //   link:'https://app-customine.gusuku.io/drive.html',
  //   icon:'settings_suggest'
  // },
  // {
  //   title:'Kintone API ドキュメント',
  //   caption:'Kintone API',
  //   link:'https://cybozu.dev/ja/kintone/docs/',
  //   icon:'help_outline'
  // },
  // {
  //   title:'',
  //   isSeparator:true
  // },
  // {
  //   title: 'Docs',
  //   caption: 'quasar.dev',
  //   icon: 'school',
  //   link: 'https://quasar.dev'
  // },
  // {
  //   title: 'Icons',
  //   caption: 'Material Icons',
  //   icon: 'insert_emoticon',
  //   link: 'https://fonts.google.com/icons?selected=Material+Icons:insert_emoticon:'
  // },
  // {
  //   title: 'Github',
  //   caption: 'github.com/quasarframework',
  //   icon: 'code',
  //   link: 'https://github.com/quasarframework'
  // },
  // {
  //   title: 'Discord Chat Channel',
  //   caption: 'chat.quasar.dev',
  //   icon: 'chat',
  //   link: 'https://chat.quasar.dev'
  // },
  // {
  //   title: 'Forum',
  //   caption: 'forum.quasar.dev',
  //   icon: 'record_voice_over',
  //   link: 'https://forum.quasar.dev'
  // },
  // {
  //   title: 'Twitter',
  //   caption: '@quasarframework',
  //   icon: 'rss_feed',
  //   link: 'https://twitter.quasar.dev'
  // },
  // {
  //   title: 'Facebook',
  //   caption: '@QuasarFramework',
  //   icon: 'public',
  //   link: 'https://facebook.quasar.dev'
  // },
  // {
  //   title: 'Quasar Awesome',
  //   caption: 'Community Quasar projects',
  //   icon: 'favorite',
  //   link: 'https://awesome.quasar.dev'
  // }
];

const version = process.env.version;
const productName = process.env.productName;

function toggleLeftDrawer() {
  authStore.toggleLeftMenu();
}
</script>
