/**
 * 赛事相关API接口
 */

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

export default {
  /**
   * 获取轮播图列表
   * @param {Object} params 查询参数
   * @returns {Promise}
   */
  getBannerList(params = {}) {
    return request.get('/martial/banner/list', params)
  },

  /**
   * 获取赛事列表（分页）
   * @param {Object} params 查询参数 { current, size, location, status }
   * @returns {Promise}
   */
  getCompetitionList(params = {}) {
    return request.get('/martial/competition/list', {
      current: params.current || 1,
      size: params.size || 10,
      ...params
    })
  },

  /**
   * 获取赛事详情
   * @param {String|Number} id 赛事ID
   * @returns {Promise}
   */
  getCompetitionDetail(id) {
    return request.get('/martial/competition/detail', { id })
  },

  /**
   * 获取比赛项目列表
   * @param {Object} params 查询参数 { competitionId }
   * @returns {Promise}
   */
  getProjectList(params = {}) {
    return request.get('/martial/project/list', params)
  },

  /**
   * 获取项目详情
   * @param {String|Number} id 项目ID
   * @returns {Promise}
   */
  getProjectDetail(id) {
    return request.get('/martial/project/detail', { id })
  },

  /**
   * 获取赛事规程
   * @param {String|Number} competitionId 赛事ID
   * @returns {Promise}
   */
  getCompetitionRules(competitionId) {
    return request.get('/martial/competition/rules', { competitionId })
  }
}
