/**
 * 选手管理API接口
 */

import request from '@/utils/request.js'

export default {
  /**
   * 获取选手列表
   */
  getAthleteList(params = {}) {
    return request.get('/martial/athlete/list', {
      current: params.current || 1,
      size: params.size || 100,
      ...params
    })
  },

  /**
   * 获取选手详情
   */
  getAthleteDetail(id) {
    return request.get('/martial/athlete/detail', { id })
  },

  /**
   * 新增或修改选手
   */
  submitAthlete(data) {
    return request.post('/martial/athlete/submit', data)
  },

  /**
   * 删除选手
   */
  removeAthlete(ids) {
    return request.post('/martial/athlete/remove', {
      ids: Array.isArray(ids) ? ids.join(',') : ids
    })
  },

  // ========== 集体/团队相关 API ==========

  /**
   * 获取集体列表
   */
  getTeamList(params = {}) {
    return request.get('/martial/team/list', {
      current: params.current || 1,
      size: params.size || 100,
      ...params
    })
  },

  /**
   * 获取集体详情
   */
  getTeamDetail(id) {
    return request.get('/martial/team/detail', { id })
  },

  /**
   * 保存集体
   */
  saveTeam(data) {
    return request.post('/martial/team/submit', data)
  },

  /**
   * 删除集体
   */
  removeTeam(id) {
    return request.post('/martial/team/remove?id=' + id, {})
  }
}
