import { request } from "umi";
import { commonParams } from "./";
import { ProjectInfo } from "@/type";
import { TableType } from "@/enum";

/**
 * 查询数据模型列表
 * @param
 * @returns
 */
export const GetDataModelList = (data: {
  name?: string;
  folder?: string;
  type?: TableType;
}) => {
  return request("/api/erDiagram/dataModel/list", {
    method: "POST",
    data,
  });
};

/**
 * 保存更新数据模型
 * @param
 * @returns
 */
export const SaveDataModel = (data: ProjectInfo) => {
  return request("/api/erDiagram/dataModel/saveOrUpdate", {
    method: "POST",
    data,
  });
};

/**
 * 删除数据模型
 * @param
 * @returns
 */
export const DeleteDataModel = (data: { id: string }) => {
  return request("/api/erDiagram/dataModel/delete", {
    method: "POST",
    data,
  });
};

/**
 * 模型详情
 * @param id
 */
export const GetDataModelDetail = (data: { id: string }) => {
  return request("/api/erDiagram/dataModel/detail", {
    method: "POST",
    data,
  });
};
