import axiosInstance from "@/api/axios.ts";
import type {ITrayConveyLocationSearch} from "@/interface/page/trayConvey/ITrayConveyLocationSearch.ts";
import type {ITrayConveyTableData} from "@/model/table/ITrayConveyTableData.ts";

export default class TrayConveyLocationApi {

    // 分页查询
    static query(query: ITrayConveyLocationSearch, pageSize: number, pageIndex: number) {
        return axiosInstance.post("/app/trayConveyLocation/queryTrayConveyLocation", query, {
            params: {
                pageSize,
                pageIndex
            }
        });
    };

    // 新增
    static add(data: ITrayConveyTableData) {
        return axiosInstance.post("/app/trayConveyLocation/addTrayConveyLocation", data);
    };
    // 更新数据
    static update(data: ITrayConveyTableData) {
        return axiosInstance.post("/app/trayConveyLocation/updateTrayConveyLocation", data);
    };
    // 查询状态
    static queryTrayConveyStatus(locationId: string | undefined) {
        return axiosInstance.get("/app/trayConveyLocation/queryTrayConveyStatus", {
            params: {
                conveyId: locationId
            }
        });
    };
    // 下载库位信息
    static downloadTrayConveyLocation(query: ITrayConveyLocationSearch) {
        return axiosInstance.post("/app/trayConveyLocation/downloadTrayConveyLocation", query, {
            responseType: "blob",
            timeout: 30000
        });
    }
}