import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
export const useWorkflowStore = create()(devtools((set) => ({
    title: '',
    setWorkflowToolbarTitle: (title) => set((state) => ({ title: title })),
    taskDataMap: {},
    updateTaskDataMap: (taskId, pageId, data) => set((state) => {
        const updatedTaskDataMap = Object.assign({}, state.taskDataMap);
        if (updatedTaskDataMap[taskId]) {
            if (updatedTaskDataMap[taskId][pageId]) {
                updatedTaskDataMap[taskId][pageId] = data;
            }
            else {
                updatedTaskDataMap[taskId] = {
                    [pageId]: data
                };
            }
        }
        else {
            updatedTaskDataMap[taskId] = {
                [pageId]: data
            };
        }
        return {
            taskDataMap: updatedTaskDataMap
        };
    }),
    setTaskDataMap: (taskId, data) => set((state) => {
        const updatedTaskDataMap = Object.assign({}, state.taskDataMap);
        updatedTaskDataMap[taskId] = data;
        return {
            taskDataMap: updatedTaskDataMap
        };
    })
})));
//# sourceMappingURL=workflowStore.js.map