import type { StateCreator } from "zustand";
import type { EditorState } from "./use-lesson-plan-editor";

export interface SelectionSlice {
  selectedNodeId: string | null;
  selectNode: (id: string | null) => void;
}

export const createSelectionSlice: StateCreator<
  EditorState,
  [],
  [],
  SelectionSlice
> = (set) => ({
  selectedNodeId: null,
  selectNode: (id) => set({ selectedNodeId: id }),
});
