import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';

export type Lang = 'RU' | 'EN';

export const useLanguageStore = create<{
  lang: Lang;
  setLang: (lang: Lang) => void;
}>()(
  devtools(
    persist(
      set => ({
        lang: 'RU',
        setLang: (lang: Lang) => {
          set({ lang: lang });
        },
      }),
      {
        name: 'lang',
      },
    ),
  ),
);
