import axiosApi from './AxiosApi.js'

const apiList = {
  getGroupList: `/productGroup/page`,
  productGroup: `/productGroup`,
  deleteGroup: `/productGroup/delProductCategory`,
  getProductList: `/product/findAdminProductList`,
  findCategoryList: '/productCategory/findCategoryListByDepth/',
  saveProduct: '/product/save',
  findAdminProductList: '/platformProduct/findAdminProductList',
  findGoods: '/platformProduct/findProductListByCategoryOrProductIdList',
  queryAllCategory: '/productCategory/queryAllCategory'
}

export default {
  queryAllCategory() {
    return axiosApi({
      method: 'POST',
      url: apiList.queryAllCategory
    })
  },
  findGoods(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.findGoods,
      data
    })
  },
  findAdminProductList(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.findAdminProductList,
      data
    })
  },
  saveProduct(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.saveProduct,
      data
    })
  },
  findCategoryList(depth) {
    return axiosApi({
      method: 'GET',
      url: apiList.findCategoryList + depth
    })
  },
  getProductList(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.getProductList,
      data
    })
  },
  getGroupList(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.getGroupList,
      data
    })
  },
  addGroup(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.productGroup,
      data
    })
  },
  eidtGroup(data) {
    return axiosApi({
      method: 'PUT',
      url: apiList.productGroup,
      data
    })
  },
  deleteGroup(data) {
    return axiosApi({
      method: 'POST',
      url: apiList.deleteGroup,
      data
    })
  }
}
