import request from '@/axios'

// 获取赛事列表
export const getCompetitionList = (params) => {
  return request({
    url: '/api/martial/competition/list',
    method: 'get',
    params
  })
}

// 获取赛事规程（小程序端）
export const getCompetitionRules = (params) => {
  return request({
    url: '/api/martial/competition/rules',
    method: 'get',
    params
  })
}

// ==================== 附件管理 ====================

// 获取附件列表
export const getAttachmentList = (params) => {
  return request({
    url: '/api/martial/competition/rules/attachment/list',
    method: 'get',
    params
  })
}

// 保存附件
export const saveAttachment = (data) => {
  return request({
    url: '/api/martial/competition/rules/attachment/save',
    method: 'post',
    data
  })
}

// 删除附件
export const removeAttachment = (params) => {
  return request({
    url: '/api/martial/competition/rules/attachment/remove',
    method: 'post',
    params
  })
}

// ==================== 章节管理 ====================

// 获取章节列表
export const getChapterList = (params) => {
  return request({
    url: '/api/martial/competition/rules/chapter/list',
    method: 'get',
    params
  })
}

// 保存章节
export const saveChapter = (data) => {
  return request({
    url: '/api/martial/competition/rules/chapter/save',
    method: 'post',
    data
  })
}

// 删除章节
export const removeChapter = (params) => {
  return request({
    url: '/api/martial/competition/rules/chapter/remove',
    method: 'post',
    params
  })
}

// ==================== 章节内容管理 ====================

// 获取章节内容列表
export const getContentList = (params) => {
  return request({
    url: '/api/martial/competition/rules/content/list',
    method: 'get',
    params
  })
}

// 保存章节内容
export const saveContent = (data) => {
  return request({
    url: '/api/martial/competition/rules/content/save',
    method: 'post',
    data
  })
}

// 批量保存章节内容
export const batchSaveContents = (data) => {
  return request({
    url: '/api/martial/competition/rules/content/batch-save',
    method: 'post',
    data
  })
}

// 删除章节内容
export const removeContent = (params) => {
  return request({
    url: '/api/martial/competition/rules/content/remove',
    method: 'post',
    params
  })
}
