import { create } from "zustand";
import { immer } from "zustand/middleware/immer";
import { MODES } from "../config";
import { persist } from "zustand/middleware";

const store = (set) => ({
  mode: MODES.PENDING,
  isImportMode: false,

  setMode: (mode) => {
    set((state) => {
      state.mode = mode;
    });
  },
  setImportMode: (value) => {
    set((state) => {
      state.isImportMode = value
    });
  }
});

export const useMode = create(persist(immer(store), { name: "postnet/mode" }));
