import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import { router } from './router';
import '../../styles/app.scss';
import { installVueQuery } from './shared/plugin/vueQuery';
import { i18n } from './shared/i18n';
import { useUserPreferencesStore } from './domain/setting/application/store/userPreferencesStore';

// Création du store
const pinia = createPinia();

// Création de l'application
const app = createApp(App);

// Installation des plugins
app.use(router);
app.use(pinia);
app.use(installVueQuery);
app.use(i18n);

// Appliquer le thème et la langue sauvegardés
const prefs = useUserPreferencesStore();
prefs.applyTheme();
i18n.global.locale.value = prefs.language;

// Montage de l'application
app.mount('#vue-app');
