<script setup>
import AppHeader from './AppHeader.vue'
import AppSidebar from './AppSidebar.vue'
import MobileNav from './MobileNav.vue'
import CriticalAlertBanner from '@/components/alerts/CriticalAlertBanner.vue'
import { useSettingsStore } from '@/stores/settings'
import { useCriticalAlertPolling } from '@/composables/useCriticalAlertPolling'

const settingsStore = useSettingsStore()
useCriticalAlertPolling(settingsStore.pollInterval)
</script>

<template>
  <a
    href="#main-content"
    class="sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-50 focus:rounded-lg focus:bg-blue-600 focus:px-4 focus:py-3 focus:text-sm focus:font-medium focus:text-white focus:outline-none focus:ring-2 focus:ring-blue-400"
  >
    Skip to main content
  </a>
  <div class="flex min-h-screen bg-gray-50 dark:bg-gray-950">
    <AppSidebar />
    <div class="flex min-w-0 flex-1 flex-col">
      <AppHeader />
      <CriticalAlertBanner />
      <main id="main-content" class="flex-1 overflow-y-auto p-4 pb-24 lg:p-8 lg:pb-8" tabindex="-1">
        <div class="mx-auto w-full max-w-7xl">
          <slot />
        </div>
      </main>
    </div>
    <MobileNav />
  </div>
</template>
