import { create } from "zustand";
import { immer } from "zustand/middleware/immer";

const store = (set) => ({
  selectedSourceConfig: {
    sourceId: null,
    dispatcherNumber: null
  },

  setSelectedSourceConfig: ({pointId, sourceId, dispatcherNumber}) =>
    set((state) => {
      state.selectedSourceConfig = { pointId, sourceId, dispatcherNumber: dispatcherNumber || null }
    }),
});

export const useSimulateAccident = create(immer(store));
