import request from "./request";

export async function queryProject(params) {
  return await request("v2/approval/record", "GET", params);
}

export async function queryAuth(params) {
  return await request("v2/approval/list/auth", "GET", params);
}

export async function queryProjectType() {
  return await request("v2/approval/type/dic", "GET");
}

export async function queryIndustry() {
  return await request("v2/approval/industry/dic", "GET");
}

export async function queryFlow() {
  return await request("v2/approval/flow", "GET");
}

export async function deleteApproval(data) {
  return request(`v2/approval/record/${data.id}`, "DELETE");
}

export async function submitAudit(data) {
  return request(`v2/approval/audit/submit`, "POST", data);
}

export async function queryMember(params) {
  return request(`v2/project_code/user`, "GET", params);
}

export async function deleteMember(data) {
  return request(
    `v2/project_code/user/${data.project_code_id}/${data.user_id}`,
    "DELETE"
  );
}

export async function queryUserDetail(user) {
  return request(`v2/user/detail/${user.ID}`, "GET");
}

export async function authApproval(data) {
  return request(`v2/approval/auth`, "POST", data);
}

export async function createApproval(data) {
  return request(`v2/approval/record`, "POST", data);
}

export async function updateApproval(data) {
  return request(`v2/approval/record`, "PUT", data);
}

export async function queryDep(data) {
  return request(`v2/dep`, "GET", data);
}

export async function startExecution(data) {
  return request(`v2/project_code/to_exe`, "POST", data);
}

export async function startOperate(data) {
  return request(`v2/project_code/to_opt`, "POST", data);
}

export async function startWarranty(data) {
  return request(`v2/project_code/to_wty`, "POST", data);
}
