<script setup lang="ts">
const { data: navigation } = await useAsyncData('docs-navigation', () => fetchContentNavigation())
const { data: page } = await useAsyncData('docs-page-index', () => queryContent('/index').findOne())

if (!page.value) {
  throw createError({ statusCode: 404, statusMessage: 'Seite nicht gefunden' })
}
</script>

<template>
  <div class="docs-layout">
    <aside class="docs-aside">
      <NuxtLink class="docs-brand" to="/">FEDEO Docs</NuxtLink>
      <DocsSidebar :items="navigation || []" />
    </aside>

    <main class="docs-main">
      <article class="docs-article">
        <ContentRenderer :value="page" />
      </article>
    </main>
  </div>
</template>
