<template>
  <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
    <div class="container-fluid">
      <NuxtLink class="navbar-brand" to="/">
        <i class="bi bi-clipboard-check me-2"></i>
        주간업무보고
      </NuxtLink>

      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
        <span class="navbar-toggler-icon"></span>
      </button>

      <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav me-auto">
          <li class="nav-item">
            <NuxtLink class="nav-link" to="/" active-class="active">
              <i class="bi bi-house me-1"></i> 대시보드
            </NuxtLink>
          </li>
          <li class="nav-item">
            <NuxtLink class="nav-link" to="/report/weekly" active-class="active">
              <i class="bi bi-journal-text me-1"></i> 주간보고
            </NuxtLink>
          </li>
          <li class="nav-item">
            <NuxtLink class="nav-link" to="/report/summary" active-class="active">
              <i class="bi bi-collection me-1"></i> 취합보고
            </NuxtLink>
          </li>
          <li class="nav-item">
            <NuxtLink class="nav-link" to="/project" active-class="active">
              <i class="bi bi-folder me-1"></i> 프로젝트
            </NuxtLink>
          </li>
          <li class="nav-item">
            <NuxtLink class="nav-link" to="/employee" active-class="active">
              <i class="bi bi-people me-1"></i> 사원관리
            </NuxtLink>
          </li>
        </ul>

        <!-- 사용자 정보 -->
        <div class="d-flex align-items-center" v-if="currentUser">
          <span class="text-white me-3">
            <i class="bi bi-person-circle me-1"></i>
            {{ currentUser.employeeName }}
          </span>
          <button class="btn btn-outline-light btn-sm" @click="handleLogout">
            <i class="bi bi-box-arrow-right"></i> 로그아웃
          </button>
        </div>
      </div>
    </div>
  </nav>
</template>

<script setup lang="ts">
const { currentUser, logout } = useAuth()
const router = useRouter()

async function handleLogout() {
  await logout()
  router.push('/login')
}
</script>

<style scoped>
.navbar-brand {
  font-weight: 600;
}
.nav-link {
  padding: 0.5rem 1rem;
}
.nav-link.active {
  font-weight: 500;
}
</style>
