import request from '@/axios';

// ==================== 评分管理接口 ====================

/**
 * 评分分页查询
 * @param {Number} current - 当前页,默认1
 * @param {Number} size - 每页条数,默认10
 * @param {Object} params - 查询参数
 */
export const getScoreList = (current, size, params) => {
  return request({
    url: '/api/blade-martial/score/list',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}

/**
 * 获取评分详情
 * @param {Number} id - 评分主键ID
 */
export const getScoreDetail = (id) => {
  return request({
    url: '/api/blade-martial/score/detail',
    method: 'get',
    params: { id }
  })
}

/**
 * 获取选手的所有裁判评分
 * @param {Number} playerId - 选手ID
 * @param {Number} projectId - 比赛项目ID
 */
export const getPlayerScores = (playerId, projectId) => {
  return request({
    url: '/api/blade-martial/score/player-scores',
    method: 'get',
    params: { playerId, projectId }
  })
}

/**
 * 导出评分数据
 * @param {Object} params - 查询参数
 */
export const exportScores = (params) => {
  return request({
    url: '/api/blade-martial/score/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

/**
 * 获取场地列表
 * @param {Number} competitionId - 赛事ID
 */
export const getVenueList = (competitionId) => {
  return request({
    url: '/api/blade-martial/venue/list',
    method: 'get',
    params: { competitionId }
  })
}

/**
 * 获取比赛项目列表
 * @param {Number} competitionId - 赛事ID
 * @param {Number} venueId - 场地ID（可选）
 */
export const getProjectList = (competitionId, venueId) => {
  return request({
    url: '/api/blade-martial/project/list',
    method: 'get',
    params: { competitionId, venueId }
  })
}
