<template>
  <RouterView />
  <Toaster position="top-right" :duration="5000" close-button />
  <CookieBanner />
  <CompleteProfileModal
    v-if="authStore.user"
    :is-open="authStore.showCompleteProfile"
    :user="authStore.user"
    @complete="authStore.onProfileComplete"
  />
</template>

<script setup lang="ts">
import { Toaster } from "vue-sonner";
import { useAuthStore } from "@/stores/auth";
import { defineAsyncComponent } from "vue";

const CompleteProfileModal = defineAsyncComponent(() => import("@/components/CompleteProfileModal.vue"));
const CookieBanner = defineAsyncComponent(() => import("@/components/CookieBanner.vue"));

const authStore = useAuthStore();
authStore.init();
</script>
