import service from '@/utils/request'

// @Summary 获取栏目树
// @Produce  application/json
// @Router /cms/channel/getTree [get]
export const getChannelTree = () => {
  return service({
    url: '/cms/channel/getTree',
    method: 'get',
  })
}

// @Summary 新增栏目
// @Produce  application/json
// @Param channel Object
// @Router /cms/channel/add [post]
export const addChannel = (data) => {
  return service({
    url: '/cms/channel/add',
    method: 'post',
    data
  })
}

// @Summary 删除栏目
// @Produce  application/json
// @Param ID int
// @Router /cms/channel/delete [delete]
export const deleteChannel = (data) => {
  return service({
    url: '/cms/channel/delete',
    method: 'delete',
    data
  })
}

// @Summary 修改栏目
// @Produce  application/json
// @Param channel Object
// @Router /cms/channel/update [put]
export const updateChannel = (data) => {
  return service({
    url: '/cms/channel/update',
    method: 'put',
    data
  })
}

// @Tags 文章栏目
// @Summary 根据id获取栏目
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param id int true "根据id获取栏目"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /cms/channel/get [get]
export const getChannelById = (params) => {
  return service({
    url: '/cms/channel/get',
    method: 'get',
    params
  })
}

// @Tags 文章栏目
// @Summary 获取模板options
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /cms/channel/getTplOptions [get]
export const getTplOptions = () => {
  return service({
    url: '/cms/channel/getTplOptions',
    method: 'get',
  })
}
