import axios from 'axios';

// 公共路径
const urlPrefix = '/api/v1/bpms-workbench';

// 添加协作用户
export function addCollaborator(params: {
  componentBaseId: string | number,
  collaboratorId: string,
  permission: string
}) {
  return axios.post(`${urlPrefix}/componentCollaborator/submit`, params);
}

// 删除协作用户
export function deleteCollaborator(id: string) {
  return axios.post(`${urlPrefix}/componentCollaborator/delete?id=${id}`);
}

// 组件协作 同步gitea协作者数据到本地
export function synchronizeCollaborator(componentBaseId: string | number) {
  return axios.get(`${urlPrefix}/componentCollaborator/synchronize`, { params: { componentBaseId } });
}

// 获取该组件下的协作者列表
export function getCollaboratorList(componentBaseId: string | number) {
  return axios.get(`${urlPrefix}/componentCollaborator/list`, { params: { componentBaseId } });
}