import { ref } from 'vue';

const globalParams = ref<Record<string, any>>({});
const globalParamsVersion = ref(0);

function updateGlobalParam(key: string, value: any) {
  globalParams.value = { ...globalParams.value, [key]: value };
  globalParamsVersion.value++;
}

function clearGlobalParams() {
  globalParams.value = {};
  globalParamsVersion.value++;
}

export function useDashboardRuntime() {
  return {
    clearGlobalParams,
    globalParams,
    globalParamsVersion,
    updateGlobalParam,
  };
}
