import { defineStore } from 'pinia' import { ref } from 'vue' export interface StepToolsInfo { workflowId: string stepDefines: any formData: any currentStepData: any readOnly: boolean callbackFunction: Function businessData: any } export const useStepStore = defineStore('apply-step', () => { const stepState = ref({ workflowId: '0', stepDefines: undefined, formData: undefined, currentStepData: undefined, readOnly: false, callbackFunction: () => { return true }, businessData: undefined, }) const getWorkflowId = () => { return stepState.value.workflowId || '0' } const getStepDefines = () => { return stepState.value.stepDefines || {} } const getFormData = () => { return stepState.value.formData || {} } const getReadOnly = () => { return stepState.value.readOnly || false } const getCurrentStepData = () => { return stepState.value.currentStepData || {} } const getCallbackFunction = () => { return stepState.value.callbackFunction || undefined } const getBusinessData = () => { return stepState.value.businessData || {} } const setWorkflowId = (workflowId: string) => { stepState.value.workflowId = workflowId } const setStepDefines = (stepDefines: any) => { stepState.value.stepDefines = stepDefines } const setFormData = (formData: any) => { stepState.value.formData = formData } const setCurrentStepData = (currentStepData: any) => { stepState.value.currentStepData = currentStepData } const setReadOnly = (readOnly: boolean) => { stepState.value.readOnly = readOnly } const setCallbackFunction = (callbackFunction: Function) => { stepState.value.callbackFunction = callbackFunction } const setBusinessData = (businessData: any) => { stepState.value.businessData = businessData } return { stepState, getWorkflowId, getStepDefines, getFormData, getCurrentStepData, getReadOnly, getCallbackFunction, getBusinessData, setWorkflowId, setStepDefines, setFormData, setCurrentStepData, setReadOnly, setCallbackFunction, setBusinessData, } }) export default useStepStore