import { ref } from "vue";
import { useProjectInfoStore } from "@/stores/projectInfo";

/**
 * 详情页通用逻辑：加载缓存项目信息 + 控制项目选择禁用状态
 * @returns {{ projectDisabled: import('vue').Ref<boolean>, cachedInfo: object|null }}
 */
export function useProjectDetail() {
  const store = useProjectInfoStore();
  const projectDisabled = ref(false);

  const cachedInfo = store.loadProjectInfo();
  if (cachedInfo) {
    projectDisabled.value = true;
  }

  return { projectDisabled, cachedInfo };
}
