import { request } from "umi";
import { commonParams } from "./index";

/**
 * 系统设计图列表
 * @param
 */
export const FlowchartMindMapList = (data: commonParams) => {
  return request("/api/flowchartMindMap/list", {
    method: "POST",
    data,
  });
};

/**
 * 系统设计图详情
 * @param
 */
export const FlowchartMindMapInfo = (data: { id: string }) => {
  return request("/api/flowchartMindMap/info", {
    method: "POST",
    data,
  });
};

/**
 * 添加系统设计图
 * @param 1思维导图 其他自定义
 */
export const AddGraph = (data: { type: string, folderId: string }) => {
  return request("/api/flowchartMindMap/addGraph", {
    method: "POST",
    data,
  });
};

/**
 * 修改系统设计图信息
 * @param
 */
export const EditGraph = (data) => {
  return request("/api/flowchartMindMap/editGraph", {
    method: "POST",
    data,
  });
};

/**
 * 删除系统设计图信息
 * @param
 */
export const DeleteGraph = (data: { id: string }) => {
  return request("/api/flowchartMindMap/deleteGraph", {
    method: "POST",
    data,
  });
};

/**
 * 添加流程图元素
 * @param
 */
export const AddFlowchartElement = (data) => {
  return request("/api/flowchartMindMap/addFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 编辑流程图元素
 * @param
 */
export const EditFlowchartElement = (data) => {
  return request("/api/flowchartMindMap/editFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 删除流程图元素
 * @param
 */
export const DeleteFlowchartElement = (data: { id: string }) => {
  return request("/api/flowchartMindMap/deleteFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量新增思维导图元素
 * @param
 */
export const BatchAddFlowchartElement = (data: any[]) => {
  return request("/api/flowchartMindMap/batchAddFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量删除流程图元素
 * @param
 */
export const BatchDeleteFlowchartElement = (data: { ids: string[] }) => {
  return request("/api/flowchartMindMap/batchDeleteFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量编辑思维导图元素
 * @param
 */
export const BatchEditFlowchartElement = (data: any[]) => {
  return request("/api/flowchartMindMap/batchEditFlowchartElement", {
    method: "POST",
    data,
  });
};

/**
 * 添加思维导图元素
 * @param
 */
export const AddMindMapElement = (data) => {
  return request("/api/flowchartMindMap/addMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 编辑思维导图元素
 * @param
 */
export const EditMindMapElement = (data) => {
  return request("/api/flowchartMindMap/editMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 删除思维导图元素
 * @param
 */
export const DeleteMindMapElement = (data: { id: string }) => {
  return request("/api/flowchartMindMap/deleteMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量新增思维导图元素
 * @param
 */
export const BatchAddMindMapElement = (data: any[]) => {
  return request("/api/flowchartMindMap/batchAddMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量删除思维导图元素
 * @param
 */
export const BatchDeleteMindMapElement = (data: { ids: string[] }) => {
  return request("/api/flowchartMindMap/batchDeleteMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 批量编辑思维导图元素
 * @param
 */
export const BatchEditMindMapElement = (data: any[]) => {
  return request("/api/flowchartMindMap/batchEditMindMapElement", {
    method: "POST",
    data,
  });
};

/**
 * 新增文件夹
 * @param
 */
export const AddFolder = (data: { name: string, parentId: string }) => {
  return request("/api/flowchartMindMap/addFolder", {
    method: "POST",
    data,
  });
};

/**
 * 编辑文件夹
 * @param
 */
export const EditFolder = (data: { id: string, name: string }) => {
  return request("/api/flowchartMindMap/editFolder", {
    method: "POST",
    data,
  });
};

/**
 * 删除文件夹
 * @param
 */
export const DeleteFolder = (data: { id: string }) => {
  return request("/api/flowchartMindMap/deleteFolder", {
    method: "POST",
    data,
  });
};

/**
 * 移动文件/文件夹
 * @param
 */
export const Move = (data: { fileType: "folder" | "chart", fileId: string, targetFolderId: string }) => {
  return request("/api/flowchartMindMap/move", {
    method: "POST",
    data,
  });
};

/**
 * 移动文件/文件夹
 * @param
 */
export const Copy = (data: { fileType: "folder" | "chart", fileId: string, targetFolderId: string }) => {
  return request("/api/flowchartMindMap/copy", {
    method: "POST",
    data,
  });
};

/**
 * 全部文件夹
 * @param
 */
export const GetAllFolders = () => {
  return request("/api/flowchartMindMap/getAllFolders", {
    method: "POST",
  });
};

/**
 * 保存全部
 * @param
 */
export const SaveAll = (data: any) => {
  return request("/api/flowchartMindMap/saveAll", {
    method: "POST",
    data
  });
};

/**
 * 最近文件
 * @param
 */
export const RecentFile = () => {
  return request("/api/flowchartMindMap/recentFile", {
    method: "POST",
  });
};

/**
 * 历史记录列表
 * @param
 */
export const HistoryList = (data: {id: string}) => {
  return request("/api/flowchartMindMap/history/list", {
    method: "POST",
    data
  });
};

/**
 * 删除历史记录
 * @param
 */
export const DeleteHistory = (data: {id: string}) => {
  return request("/api/flowchartMindMap/history/delete", {
    method: "POST",
    data
  });
};

/**
 * 恢复历史记录
 * @param
 */
export const RevertHistory = (data: {id: string}) => {
  return request("/api/flowchartMindMap/history/revert", {
    method: "POST",
    data
  });
};