/**
 * 成绩相关API接口
 */

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

export default {
  /**
   * 获取成绩列表
   * @param {String|Number} eventId 赛事ID
   * @param {Object} params 查询参数 { projectId, current, size }
   * @returns {Promise}
   */
  getResultList(eventId, params = {}) {
    return request.get('/martial/result/list', {
      competitionId: eventId,
      current: params.current || 1,
      size: params.size || 100,
      ...params
    })
  },

  /**
   * 获取成绩详情
   * @param {String|Number} id 成绩ID
   * @returns {Promise}
   */
  getResultDetail(id) {
    return request.get('/martial/result/detail', { id })
  },

  /**
   * 获取奖牌榜
   * @param {String|Number} eventId 赛事ID
   * @param {Object} params 查询参数
   * @returns {Promise}
   */
  getMedalsList(eventId, params = {}) {
    return request.get('/martial/medal/list', {
      competitionId: eventId,
      ...params
    })
  },

  /**
   * 获取评分列表
   * @param {Object} params 查询参数 { resultId, current, size }
   * @returns {Promise}
   */
  getScoreList(params = {}) {
    return request.get('/martial/score/list', {
      current: params.current || 1,
      size: params.size || 100,
      ...params
    })
  }
}
