import type IStackerLocationSearch from "@/interface/page/stackerLocation/IStackerLocationSearch.ts";
import axiosInstance from "@/api/axios.ts";
import type IStackerLocationTableData from "@/model/table/IStackerLocationTableData.ts";
import type IStackerLocationCreateParams from "@/interface/page/stackerLocation/IStackerLocationCreateParams.ts";

export default class StackerLocationApi {

    // 分页查询
    static queryStackerLocation(queryData: IStackerLocationSearch,  pageSize: number, pageIndex: number) {
        return axiosInstance.post("/app/stackerLocation/queryStackerLocation", queryData, {
            params: {
                pageSize: pageSize,
                pageIndex: pageIndex,
            }
        });
    };
    // 添加一个库位
    static addOneStackerLocation(data: IStackerLocationTableData) {
        return axiosInstance.post("/app/stackerLocation/addStackerLocation", data);
    };
    // 批量添加库位
    static addStackerLocationBatch(data: IStackerLocationCreateParams) {
        return axiosInstance.post("/app/stackerLocation/addStackerLocations", data);
    };
    // 下载货位信息
    static downloadStackerLocation(queryData: IStackerLocationSearch) {
        return axiosInstance.post("/app/stackerLocation/downloadStackerLocation", queryData, {
            responseType: "blob",
            timeout: 30000
        });
    };
    // 更新站台信息
    static updateStackerLocation(data: IStackerLocationTableData) {
        return axiosInstance.post("/app/stackerLocation/updateStackerLocation", data);
    };
    // 根据巷道号查询货位信息
    static queryStackerLocationByStackerIdAndLaneId(stackerId: number, laneId: number) {
        return axiosInstance.get("/app/stackerLocation/queryStackerLocationListByStackerIdAndLaneId", {
            params: {
                stackerId: stackerId,
                laneId: laneId
            }
        });
    };
    // 获取堆垛机ID
    static getStackerIdList() {
        return axiosInstance.get("/app/stackerLocation/queryStackerLocationStackerIdList");
    };
    // 获取巷道ID
    static getLaneIdList(stackerId: number) {
        return axiosInstance.get("/app/stackerLocation/queryStackerLocationLaneList", {
            params: {
                stackerId: stackerId
            }
        });
    }

}