import service from '@/utils/request'
// @Tags Category
// @Summary 创建类别
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body model.Category true "创建类别"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /cat/createCategory [post]
export const createCategory = (data) => {
  return service({
    url: '/cat/createCategory',
    method: 'post',
    data
  })
}

// @Tags Category
// @Summary 删除类别
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body model.Category true "删除类别"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /cat/deleteCategory [delete]
export const deleteCategory = (params) => {
  return service({
    url: '/cat/deleteCategory',
    method: 'delete',
    params
  })
}

// @Tags Category
// @Summary 批量删除类别
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除类别"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /cat/deleteCategory [delete]
export const deleteCategoryByIds = (params) => {
  return service({
    url: '/cat/deleteCategoryByIds',
    method: 'delete',
    params
  })
}

// @Tags Category
// @Summary 更新类别
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data body model.Category true "更新类别"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /cat/updateCategory [put]
export const updateCategory = (data) => {
  return service({
    url: '/cat/updateCategory',
    method: 'put',
    data
  })
}

// @Tags Category
// @Summary 用id查询类别
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query model.Category true "用id查询类别"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /cat/findCategory [get]
export const findCategory = (params) => {
  return service({
    url: '/cat/findCategory',
    method: 'get',
    params
  })
}

// @Tags Category
// @Summary 分页获取类别列表
// @Security ApiKeyAuth
// @Accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取类别列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /cat/getCategoryList [get]
export const getCategoryList = (params) => {
  return service({
    url: '/cat/getCategoryList',
    method: 'get',
    params
  })
}

// @Tags Category
// @Summary 不需要鉴权的类别接口
// @Accept application/json
// @Produce application/json
// @Param data query categoryReq.CategorySearch true "分页获取类别列表"
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
// @Router /cat/getCategoryPublic [get]
export const getCategoryPublic = () => {
  return service({
    url: '/cat/getCategoryPublic',
    method: 'get',
  })
}
