import { get, post } from "@/utils/request";

// 获取项目列表
export function getProjectList({ page, perPage, projectName }) {
  return get({
    url: `api/v1/project/list`,
    params: {
      page,
      per_page: perPage,
      project_name: projectName,
    },
  });
}

// 获取项目详情
export function getProjectDetail({ projectId }) {
  return get({
    url: `api/v1/project/info`,
    params: {
      project_id: projectId,
    },
  });
}

// 保存
export function saveProject(data) {
  return post({
    url: `/api/v1/project/save`,
    data,
  });
}

// 删除
export function deleteProject({ projectId }) {
  return post({
    url: `/api/v1/project/del`,
    data: {
      project_id: projectId,
    },
  });
}

// 检测数据库链接
export function checkDbConnect(data) {
  return post({
    url: `/api/v1/project/check-database-connect`,
    data,
  });
}

// 修改展示状态
export function updateStatus(data) {
  return post({
    url: `/api/v1/project/change-status`,
    data,
  });
}
