import type {ISiemensDbSearch} from "@/interface/page/siemensDbManage/ISiemensDbSearch.ts";
import axiosInstance from "@/api/axios.ts";
import type {IAppBaseDb} from "@/model/table/IAppBaseDb.ts";

export default class SiemensDbApi {

    /**
     * 获取app基础数据库列表
     * @param pageIndex
     * @param pageSize
     * @param params
     */
    public static async getAppBaseDb(pageIndex: number, pageSize: number, params: ISiemensDbSearch): Promise<any> {
        return await axiosInstance.post('/app/siemensDb/querySiemensDbByPage', params, {
            params: {
                pageIndex: pageIndex,
                pageSize: pageSize
            }
        });
    };

    /**
     * 添加app基础数据库
     * @param params
     */
    public static addSiemensDb(params: IAppBaseDb): Promise<any> {
        return axiosInstance.post('/app/siemensDb/addSiemensDb', params);
    };

    /**
     * 修改app基础数据库
     * @param params
     */
    public static updateSiemensDb(params: IAppBaseDb): Promise<any> {
        return axiosInstance.post('/app/siemensDb/updateSiemensDb', params);
    };

    /**
     * 删除app基础数据库
     * @param dbName
     */
    public static deleteSiemensDb(dbName: string): Promise<any> {
        return axiosInstance.delete('/app/siemensDb/deleteSiemensDb', {
            params: {
                dbName: dbName
            }
        });
    };

    /**
     * 重新加载数据库地址
     */
    public static reloadDbAddress(): Promise<any> {
        return axiosInstance.put('/app/siemensDb/reloadDbAddress');
    };
}