// 电子标签基础资料接口
import type {IEtagControllerQuery} from "@/interface/page/etagController/IEtagControllerQuery.ts";
import axiosInstance from "@/api/axios.ts";
import type {IAppEtagController} from "@/model/table/IAppEtagController.ts";
import type {IEtagTagQuery} from "@/interface/page/etagTag/IEtagTagQuery.ts";
import type {IAppEtagTag} from "@/model/table/IAppEtagTag.ts";
import type {IEtagLocationQuery} from "@/interface/page/etagLocation/IEtagLocationQuery.ts";
import type {IAppEtagLocation} from "@/model/table/IAppEtagLocation.ts";

export default class EtagBaseApi {

    /**
     * 获取电子标签控制器信息
     * @param pageIndex
     * @param pageSize
     * @param params
     */
    public static getEtagControllerInfo(pageIndex: number, pageSize: number, params: IEtagControllerQuery) {
        return axiosInstance.post('/app/etag/queryEtagController', params, {
            params: {
                pageIndex: pageIndex,
                pageSize: pageSize
            }
        });
    };

    /**
     * 添加电子标签控制器信息
     * @param params
     */
    public static addEtagControllerInfo(params: IAppEtagController) {
        return axiosInstance.post('/app/etag/addEtagController', params);
    };

    /**
     * 修改电子标签控制器信息
     * @param params
     */
    public static updateEtagControllerInfo(params: IAppEtagController) {
        return axiosInstance.put('/app/etag/updateEtagController', params);
    };

    /**
     * 删除电子标签控制器信息
     * @param controllerId
     */
    public static deleteEtagControllerInfo(controllerId: number| undefined) {
        return axiosInstance.delete('/app/etag/deleteEtagController', {
            params: {
                controllerId: controllerId
            }
        });
    };

    /**
     * 获取电子标签小标签信息
     * @param pageIndex
     * @param pageSize
     * @param params
     */
    public static getEtagTagInfo(pageIndex: number, pageSize: number, params: IEtagTagQuery) {
        return axiosInstance.post('/app/etag/queryEtagTagInfo', params, {
            params: {
                pageIndex: pageIndex,
                pageSize: pageSize
            }
        });
    };

    /**
     * 添加电子标签小标签信息
     * @param params
     */
    public static addEtagTagInfo(params: IAppEtagTag) {
        return axiosInstance.post('/app/etag/addEtagTagInfo', params);
    };

    /**
     * 修改电子标签小标签信息
     * @param params
     */
    public static updateEtagTagInfo(params: IAppEtagTag) {
        return axiosInstance.put('/app/etag/updateEtagTagInfo', params);
    };

    /**
     * 删除电子标签小标签信息
     * @param tagName
     */
    public static deleteEtagTagInfo(tagName: string| undefined) {
        return axiosInstance.delete('/app/etag/deleteEtagTagInfo', {
            params: {
                tagName: tagName
            }
        });
    };

    /**
     * 获取电子标签货位信息
     * @param pageIndex 页码
     * @param pageSize 每页数量
     * @param params 查询参数
     */
    public static getEtagLocationInfo(pageIndex: number, pageSize: number, params: IEtagLocationQuery) {
        return axiosInstance.post('/app/etag/queryEtagLocation', params, {
            params: {
                pageIndex: pageIndex,
                pageSize: pageSize
            }
        });
    };

    /**
     * 添加电子标签货位信息
     * @param params 添加参数
     */
    public static addEtagLocationInfo(params: IAppEtagLocation) {
        return axiosInstance.post('/app/etag/addEtagLocation', params);
    };

    /**
     * 修改电子标签货位信息
     * @param params 修改参数
     */
    public static updateEtagLocationInfo(params: IAppEtagLocation) {
        return axiosInstance.put('/app/etag/updateEtagLocation', params);
    };

    /**
     * 删除电子标签货位信息
     * @param recordId 货位ID
     */
    public static deleteEtagLocationInfo(recordId: string| undefined) {
        return axiosInstance.delete('/app/etag/deleteEtagLocation/' + recordId);
    };

}