import { create } from 'zustand';

interface AppState {
  darkMode: boolean;
  activeDatabase: string | null;
  activeTable: string | null;
  toggleDarkMode: () => void;
  setActiveDatabase: (db: string | null) => void;
  setActiveTable: (table: string | null) => void;
}

export const useAppStore = create<AppState>((set) => ({
  darkMode: true,
  activeDatabase: null,
  activeTable: null,
  toggleDarkMode: () => set((state) => ({ darkMode: !state.darkMode })),
  setActiveDatabase: (db) => set({ activeDatabase: db, activeTable: null }),
  setActiveTable: (table) => set({ activeTable: table }),
}));
