// import request from '/@/utils/request';
import request, { newService } from '/@/utils/request';


// 获取分类树
export function getCategoryTree(query?: Object) {
	return newService({
		url: '/assets/category/getCategoryTree',
		method: 'get',
		params: query,
	});
}

// 获取分类详情
export function getCategory(id: string) {
	return newService({
		url: '/assets/category/getCategory',
		method: 'get',
		params: { id },
	});
}

// 获取属性类型选项
export function getCategoryAttrTypeOptions() {
	return newService({
		url: '/assets/category/getCategoryAttrTypeOptions',
		method: 'get',
	});
}

// 新增分类
export function addCategory(data: object) {
	return newService({
		url: '/assets/category/createCategory',
		method: 'post',
		data: data,
	});
}

// 查询获取列表
export function listCategories(keyword: string) {
	return newService({
		url: '/assets/category/listCategories',
		method: 'get',
		params: {keyword},
	});
}

// 修改分类
export function updateCategory(data: object) {
	return newService({
		url: '/assets/category/updateCategory',
		method: 'put',
		data: data,
	});
}

// 删除分类
export function deleteCategory(id: string) {
	return newService({
		url: '/assets/category/deleteCategory',
		method: 'delete',
		params: { id },
	});
}

// 更新分类状态
export function updateCategoryStatus(id: string, status: number) {
	return newService({
		url: '/assets/category/updateCategoryStatus',
		method: 'put',
		data: { id, status },
	});
}
