import request from "@/utils/request";
import { AxiosPromise } from "axios";

// 新增测试工程表
export function addProject(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/add",
    method: "post",
    data: data,
  });
}

// 修改测试工程表
export function updateProject(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/update",
    method: "post",
    data: data,
  });
}

// 删除测试工程表
export function deleteProject(id: number): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/del",
    method: "post",
    data: {
      id: id,
    },
  });
}

// 根据id查询测试工程表
export function getProjectById(id: string): AxiosPromise {
  return request({
    url: `/api/v1/test/engineering/get/${id}`,
    method: "get",
  });
}

// 查询所有测试工程表
// 测试工程表分页查询
export function getProjectPage(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/page",
    method: "post",
    data: data,
  });
}

// 测试工程类型统计

export function getProjectTypeCount(): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/typeStatistics",
    method: "post",
    data: {},
  });
}

// 测试工程项目列表查询
export function getTestProjectList(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engrProject/list",
    method: "post",
    data: data,
  });
}

// 获取 工程配置页面  所有功能模块的接口
export function getProjectConfigMokuaiPage(): AxiosPromise {
  return request({
    url: "/api/v1/test/model/selectDetailList",
    method: "post",
    data: {},
  });
}

// 更新测试模块  后台的将流程信息保存到了 测试项目下
export function updateTestModule(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engrProject/update",
    method: "post",
    data: data,
  });
}

// 获取测试工程项目信息
export function getTestProjectInfo(id: string): AxiosPromise {
  return request({
    url: `/api/v1/test/engrProject/get/${id}`,
    method: "get",
  });
}

// 查询工程全局配置
export function getProjectGlobalConfig(engineeringId: string): AxiosPromise {
  return request({
    url: "/api/v1/test/engineering/selectEngrConfig",
    method: "post",
    data: { engineeringId: engineeringId },
  });
}

// 新增 测试模块 
export function addTestModule(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engrProject/add",
    method: "post",
    data: data,
  });
}

//删除测试模块
export function delTestModule(data: object): AxiosPromise {
  return request({
    url: "/api/v1/test/engrProject/del",
    method: "post",
    data: data,
  });
}