import { create } from "zustand";

interface ModuleStore {
  activeModule: string;
  setActiveModule: (module: string) => void;
}

const useModuleStore = create<ModuleStore>((set) => ({
  activeModule: "builder", // Initial state
  setActiveModule: (module) => set({ activeModule: module }), // Update state
}));

export default useModuleStore;

// New store for subModule

type SubModule = 'properties' | 'simulations' | 'mechanics' | 'analysis' | 'zoneProperties'|"resourceManagement";

interface SubModuleStore {
  subModule: SubModule;
  setSubModule: (subModule: SubModule) => void;
}

const useSubModuleStore = create<SubModuleStore>((set) => ({
  subModule: "properties", // Initial subModule state
  setSubModule: (value) => set({ subModule: value }), // Update subModule state
}));

export { useSubModuleStore };

interface ThreeDState {
  toggleThreeD: boolean;
  setToggleThreeD: (value: boolean) => void;
}

// Create the Zustand store
const useThreeDStore = create<ThreeDState>((set) => ({
  toggleThreeD: true, // Initial state
  setToggleThreeD: (value) => set({ toggleThreeD: value }), // Action to update the state
}));

export { useThreeDStore };