import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useProjectStore = defineStore('project', () => {
  const pid = ref('');
  const runtype = ref("");

  const projectInfo = ref(null);
  // 项目信息
  const setProjectInfo = (info) => {
    projectInfo.value = info;
  }

  const setpid = (val) => {
    pid.value = val
  }

  const setruntype = (val) => {
    runtype.value = val
  }

  const clearproject = () => {
    pid.value = ''
    projectInfo.value = null; // 清除项目信息
    runtype.value = ""; // 清除运行类型
  }
  
  return {
    pid,
    setpid,
    runtype,
    setruntype,
    clearproject,
    projectInfo,
    setProjectInfo,
  }
},{
  persist: true, // 启用持久化
})