import request from '@/utils/request'

// 查询队伍列表
export function listTeam(query) {
  return request({
    url: '/resources/teams/list',
    method: 'get',
    params: query
  })
}

// 查询队伍详情
export function getTeam(id) {
  return request({
    url: '/resources/teams/' + id,
    method: 'get'
  })
}

// 新增队伍
export function addTeam(data) {
  return request({
    url: '/resources/teams',
    method: 'post',
    data: data
  })
}

// 修改队伍
export function updateTeam(data) {
  return request({
    url: '/resources/teams',
    method: 'put',
    data: data
  })
}

// 删除队伍
export function delTeam(id) {
  return request({
    url: '/resources/teams/' + id,
    method: 'delete'
  })
}

// 查询队伍成员列表
export function listTeamMember(teamId, query) {
  return request({
    url: '/resources/teams/' + teamId + '/members',
    method: 'get',
    params: query
  })
}

// 查询成员详情
export function getTeamMember(teamId, memberId) {
  return request({
    url: '/resources/teams/' + teamId + '/members/' + memberId,
    method: 'get'
  })
}

// 新增队伍成员
export function addTeamMember(teamId, data) {
  return request({
    url: '/resources/teams/' + teamId + '/members',
    method: 'post',
    data: data
  })
}

// 修改队伍成员
export function updateTeamMember(teamId, memberId, data) {
  return request({
    url: '/resources/teams/' + teamId + '/members/' + memberId,
    method: 'put',
    data: data
  })
}

// 删除队伍成员
export function delTeamMember(teamId, memberId) {
  return request({
    url: '/resources/teams/' + teamId + '/members/' + memberId,
    method: 'delete'
  })
}