import { create } from "zustand";

interface PreviewToolbarState {
  deviceMode: "desktop" | "tablet" | "mobile";
  setDeviceMode: (mode: "desktop" | "tablet" | "mobile") => void;
  refreshKey: number;
  triggerRefresh: () => void;
  currentPath: string;
  setCurrentPath: (path: string) => void;
  selectedPort: number;
  setSelectedPort: (port: number) => void;
}

export const usePreviewToolbarStore = create<PreviewToolbarState>((set) => ({
  deviceMode: "desktop",
  setDeviceMode: (mode) => set({ deviceMode: mode }),
  refreshKey: 0,
  triggerRefresh: () => set((state) => ({ refreshKey: state.refreshKey + 1 })),
  currentPath: "/",
  setCurrentPath: (path) => set({ currentPath: path }),
  selectedPort: 3000,
  setSelectedPort: (port) => set({ selectedPort: port }),
}));
