import { createPersistStore } from "../utils/store";

const state = {
  selectedAppId: "",
  showMenu: false,
  currentSession: {
    appId: '',
    dialogName: '',
    id: '',
    messages: [],
  },
};

export const useGlobalStore = createPersistStore(
  { ...state },
  (set, get) => ({
    setSelectedAppId(appId: string) {
      set({ selectedAppId: appId });
    },
    setShowMenu(show: boolean) {
      set({ showMenu: show });
    },
    setCurrentSession(session: any) {
      set({ currentSession: session });
    },
  }),
  {
    name: "Global",
    version: 1,
  },
);