import { request } from 'umi';

//获取项目列表
export async function getProjectList(params: any): Promise<Api.IResponseStructure> {
  return request(`/api/v2/project`, {
    params,
  });
}

//获取当前项目详情
export async function queryProjectById(params: any): Promise<Api.IResponseStructure> {
  return request(`/api/v2/project/detail/${params.ID}`);
}

//获取当前项目角色列表
export async function queryProjectRole(params: any) {
  return request(`/api/v2/project/roles/get`, { params });
}

export async function addProjectUserV2(param: any) {
  return request(`/api/v2/project/user`, {
    method: 'POST',
    data: param,
  });
}


export async function queryUserList(Id: Number) {
  return request(`/api/v1/user/project/${Id}`);
}

export async function updateProject(params = {}) {
  return request(`/api/v1/project/update`, {
    method: 'PUT',
    data: params,
  });
}

export async function removeProjectUser(params: any) {
  return request(`/api/v1/project/user/${params.ProjectId}/${params.UserId}`, { method: 'DELETE' });
}
