import { defineStore } from 'pinia';
import { ref } from 'vue';
import { ELanguageLocale } from '@/UI-kit/types';
import { uiKitI18n } from '@/configs';

export const useUiKitConfigStore = defineStore('ui-kit-config-store', () => {
    const userAuthToken = ref<string>('');
    const appVersion = ref<string>('');

    const setLocale = (locale: ELanguageLocale) => {
        uiKitI18n.global.locale.value = locale;
    };

    const setGlobalModulesProperty = (locale: ELanguageLocale, token: string) => {
        setLocale(locale);
        userAuthToken.value = token;
    };

    return {
        userAuthToken,
        appVersion,

        setLocale,
        setGlobalModulesProperty,
    };
});
