import { requestClient } from '#/api/request';

const prefix = 'product-classification/';
/**
 * 分页查询商品分类列表
 * @param data
 */
export async function getProductClassificationListApi(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

/**
 * 获取商品分类详情
 * @param id
 */
export async function getProductClassificationInfoApi(id: number) {
  return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}

/**
 * 获取商品分类详情
 * @param id
 */
export async function getProductClassificationOptionApi(id: number) {
  return requestClient.get<any>(`${prefix}option`, { params: { id } });
}

/**
 * 获取商品分类详情
 * @param id
 */
export async function getProductClassificationTreeOptionApi(id: number) {
  return requestClient.get<any>(`${prefix}option`, {
    params: { id, type: 'tree' },
  });
}

/**
 * 新增商品分类
 * @param data
 */
export async function createProductClassificationApi(
  data: Record<string, any>,
) {
  return requestClient.post<any>(`${prefix}create`, data);
}

/**
 * 编辑商品分类
 * @param data
 */
export async function updateProductClassificationApi(
  data: Record<string, any>,
) {
  return requestClient.post<any>(`${prefix}update`, data);
}

/**
 * 删除商品分类
 * @param data
 */
export async function deleteProductClassificationApi(
  data: Record<string, any>,
) {
  return requestClient.post<any>(`${prefix}delete`, data);
}
