import { create } from "zustand";

interface PopupStore {
  popup: React.ReactNode | null;
  setPopup: (popup: React.ReactNode) => void;
  position: { x: number; y: number };
  setPosition: (position: { x: number; y: number }) => void;
  side: "left" | "right" | "top" | "bottom";
  setSide: (side: "left" | "right" | "top" | "bottom") => void;
}

export const usePopupStore = create<PopupStore>((set) => ({
  popup: null,
  setPopup: (popup: React.ReactNode) => set({ popup }),
  position: { x: 0, y: 0 },
  setPosition: (position: { x: number; y: number }) => set({ position }),
  side: "left",
  setSide: (side: "left" | "right" | "top" | "bottom") => set({ side }),
}));
