import http from '@/utils/http'

export function getAllGoodsNameApi() {
  return http.get('/goods/all')
}

export function getGoodsPageApi(query) {
  return http.post('/goods/page', query)
}

export function getCommentGoodsPageApi(pageIndex) {
  return http.get(`/goods/page2?pageIndex=${pageIndex}`)
}

export function setGoodsOnShelvesApi(goodsId) {
  return http.put(`/goods/on-shelves/${goodsId}`)
}

export function setGoodsOffShelvesApi(goodsId) {
  return http.put(`/goods/off-shelves/${goodsId}`)
}

export function deleteGoodsApi(goodsId) {
  return http.delete(`/goods/${goodsId}`)
}

export function addGoodsApi(body) {
  return http.post(`/goods/add`, body)
}

export function getGoodsDetailApi(goodsId) {
  return http.get(`/goods/detail/${goodsId}`)
}

export function modifyGoodsApi(body) {
  return http.put(`/goods/modify`, body)
}

export function getGoodsCommentPageApi(goodsId, pageIndex) {
  return http.get(`/goods/comment/page?goodsId=${goodsId}&pageIndex=${pageIndex}`)
}

export function deleteGoodsCommentApi(id) {
  return http.delete(`/goods/comment/${id}`)
}

export function getGoodsTypePageApi(pageIndex) {
  return http.post(`/goods-type/page?pageIndex=${pageIndex}`)
}

export function addGoodsTypeApi(body) {
  return http.post('/goods-type/add', body)
}

export function deleteGoodsTypeApi(typeId) {
  return http.delete(`/goods-type/${typeId}`)
}

export function modifyGoodsTypeApi(body) {
  return http.put('/goods-type/modify', body)
}

export function getAllGoodsTypeApi() {
  return http.get('/goods-type/all')
}
