import service from '@/utils/request'

// @Summary 获取分类树
// @Produce  application/json
// @Router /category/getTree [get]
export const getCategoryTree = () => {
  return service({
    url: '/cms/category/getTree',
    method: 'get',
  })
}

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

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

// @Summary 修改分类
// @Produce  application/json
// @Param Object
// @Router /category/update [put]
export const updateCategory = (data) => {
  return service({
    url: '/cms/category/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 /category/get [get]
export const getCategoryById = (params) => {
  return service({
    url: '/cms/category/get',
    method: 'get',
    params
  })
}
