import { QuoteScene, SceneType } from "@/store/scene";
import EditModel from "./editModel.vue";
import tableModel from "./tableModel.vue";
import SceneDownload from "./sceneDownload.vue";
import { quiskMountFactory } from "@/helper/mount";
import { axios, checkHasDownload } from "@/request";

export const editModelScene = quiskMountFactory(EditModel, {
  title: "编辑模型",
  width: 500,
});
export const tableModelScene = quiskMountFactory(tableModel, {
  title: "添加场景",
  width: 1000,
});
export type SceneDpwnloadProps = { scene: QuoteScene };
export const sceneDownload = async(props: SceneDpwnloadProps) => {
  const params = {
    num: props.scene.num,
    isObj: Number(![SceneType.SWSS, SceneType.SWYDSS].includes(props.scene.type)),
  };
  const res = await axios.get(checkHasDownload, { params });
  const hideFloor = Number(res.data.downloadStatus) !== 3

  const sceneDownloadDialog = quiskMountFactory(SceneDownload, {
    title: "场景离线包下载",
    width: 500,
    hideFloor: hideFloor,
    enterText: '下 载'
  });
  return await sceneDownloadDialog(props);
}
