import request from '/@/utils/request';

// 库区查询参数
export interface ZoneQueryParams {
	keyword?: string;
	warehouseId?: string;
	warehouseIds?: string[];
	status?: string;
	pageNum?: number;
	pageSize?: number;
}

// 库区数据接口
export interface ZoneData {
	id?: string;
	zoneName: string;
	zoneCode?: string;
	zoneType?: string;
	warehouseId: string;
	status?: string;
	remark?: string;
}

// 获取库区列表
export function listZones(params?: ZoneQueryParams) {
	return request({
		url: '/assets/zone/listZones',
		method: 'get',
		params,
	});
}

// 获取库区详情
export function getZone(id: string) {
	return request({
		url: '/assets/zone/getZone',
		method: 'get',
		params: { id },
	});
}

// 创建库区
export function createZone(data: ZoneData) {
	return request({
		url: '/assets/zone/createZone',
		method: 'post',
		data,
	});
}

// 更新库区
export function updateZone(data: ZoneData) {
	return request({
		url: '/assets/zone/updateZone',
		method: 'put',
		data,
	});
}

// 删除库区
export function deleteZone(id: string) {
	return request({
		url: '/assets/zone/deleteZone',
		method: 'delete',
		params: { id },
	});
}

// 更新库区状态
export function updateZoneStatus(data: { id: string; status: string }) {
	return request({
		url: '/assets/zone/updateZoneStatus',
		method: 'put',
		data,
	});
}
