import http from "../../utils/http";
import config from "../../config/config";

/** 获取店铺商品分类
 *
 * @author Seven
 * @data 2025-7-4
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/shop-base-product-category/tree?source_lang=zh_CN
 */

export function GetProductCategoryTree() {
  return http({
    url: "/shop/shop-base-product-category/tree",
    method: "get",
    baseURL: config.adminApi,
  });
}

/** 获取店铺商品列表
 *
 * @author Seven
 * @data 2025-7-4
 * @param { pageNum  pageSize kind_id product_src category_id }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/shop-product-base/list?pageNum=1&pageSize=20&kind_id=1201,1202,1203&product_src=false&category_id=&source_lang=zh_CN
 */

export function GetProductList(params) {
  return http({
    url: "/shop/shop-product-base/list",
    method: "get",
    params,
    baseURL: config.adminApi,
  });
}

/** 更新商品上下架
 *
 * @author Seven
 * @data 2025-7-6
 * @param { pageNum  pageSize kind_id product_src category_id }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/shop-product-base/editState?source_lang=zh_CN
 */

export function UpdateProductPutaway(params) {
  return http({
    url: "/shop/shop-product-base/editState",
    method: "post",
    params,
    baseURL: config.adminApi,
  });
}

/** 删除商品
 *
 * @author Seven
 * @data 2025-7-6
 * @param { product_id }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/shop-product-base/deleteBatch
 */

export function DelectCommodity(params) {
  return http({
    url: "/shop/shop-product-base/deleteBatch",
    method: "post",
    params,
    baseURL: config.adminApi,
  });
}

/** 获取商品规格 库存 和 价格
 *
 * @author Seven
 * @data 2025-7-6
 * @param { product_id }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/shop-product-item/items?product_id=23591&source_lang=zh_CN
 */

export function GetCommoditSpecification(params) {
  return http({
    url: "/shop/shop-product-item/items",
    method: "get",
    params,
    baseURL: config.adminApi,
  });
}
