<script setup lang="ts">
import { useUserStore } from '@/store/modules/user'
import { computed } from 'vue'

interface Props {
  agentTitle: string
}

defineProps<Props>()

const emit = defineEmits<{
  toCreateApplication: []
  toLogin: []
}>()

const userStore = useUserStore()

const isLogin = computed(() => {
  return userStore.isLogin
})

function handleToCreateApplication() {
  emit('toCreateApplication')
}

function handleToLogin() {
  emit('toLogin')
}
</script>

<template>
  <header class="flex h-[48px] w-full items-center justify-between border-b border-[#e8e9eb] bg-white px-4">
    <div class="h-[23px] w-[90px] bg-[url('@/assets/images/page-logo.png')] bg-contain bg-center bg-no-repeat" />
    <div>
      <NButton
        v-show="isLogin"
        type="primary"
        class="rounded-md! h-[32px]! text-xs! w-[80px]!"
        @click="handleToCreateApplication"
      >
        创建应用
      </NButton>
      <NButton v-show="!isLogin" type="primary" class="rounded-md! h-[32px]! text-xs! w-[80px]!" @click="handleToLogin">
        <span class="text-xs">立即登录</span>
      </NButton>
    </div>
  </header>
</template>
