import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectTeamMemberForm, ProjectTeamMemberQuery, ProjectTeamMemberVO } from '@/api/project/projectTeamMember/types';

/**
 * 查询项目班组下的成员列表
 * @param query
 * @returns {*}
 */

export const listProjectTeamMember = (query?: ProjectTeamMemberQuery): AxiosPromise<ProjectTeamMemberVO[]> => {
  return request({
    url: '/project/projectTeamMember/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目班组下的成员详细
 * @param id
 */
export const getProjectTeamMember = (id: string | number): AxiosPromise<ProjectTeamMemberVO> => {
  return request({
    url: '/project/projectTeamMember/' + id,
    method: 'get'
  });
};

/**
 * 新增项目班组下的成员
 * @param data
 */
export const addProjectTeamMember = (data: ProjectTeamMemberForm): AxiosPromise<string | number> => {
  return request({
    url: '/project/projectTeamMember',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目班组下的成员
 * @param data
 */
export const updateProjectTeamMember = (data: ProjectTeamMemberForm) => {
  return request({
    url: '/project/projectTeamMember',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目班组下的成员
 * @param id
 */
export const delProjectTeamMember = (id: string | number | Array<string | number>) => {
  return request({
    url: '/project/projectTeamMember/' + id,
    method: 'delete'
  });
};
