import request from '@/utils/request'
import { sellerShopHeaders } from '@/utils/sellerShop'

// 查询当前店铺数据范围（shopId、shopName）
export function getShopCategoryScope() {
  return request({
    url: '/agri/seller/shopCategory/scope',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 查询店铺商品分类列表（分页）
export function listShopCategory(query) {
  return request({
    url: '/agri/seller/shopCategory/list',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 查询店铺商品分类树
export function treeShopCategory(query) {
  return request({
    url: '/agri/seller/shopCategory/tree',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 一级分类下拉
export function level1ShopCategoryOptions() {
  return request({
    url: '/agri/seller/shopCategory/level1Options',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 二级分类下拉
export function level2ShopCategoryOptions() {
  return request({
    url: '/agri/seller/shopCategory/level2Options',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 查询分类详情
export function getShopCategory(categoryId) {
  return request({
    url: '/agri/seller/shopCategory/' + categoryId,
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 新增分类
export function addShopCategory(data) {
  return request({
    url: '/agri/seller/shopCategory',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 修改分类
export function updateShopCategory(data) {
  return request({
    url: '/agri/seller/shopCategory',
    method: 'put',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 删除分类（支持批量，逗号分隔 ID）
export function delShopCategory(categoryIds) {
  return request({
    url: '/agri/seller/shopCategory/' + categoryIds,
    method: 'delete',
    headers: sellerShopHeaders()
  })
}
