import request from "@/utils/request";
const requests = '/video/transcoding'// 线上
// const requests = '/video/transcoding/transcoding'// 线下
export default {
    // 添加监控信息
    async addCamera(data) {
        let requestData = await request({
            url: `${requests}/camera/addCamera`,
            method: "POST",
            headers: { "Content-Type": "application/json; charset=utf-8" },
            data: data,
        });
        return requestData;
    },

    // 删除监控信息
    async delCamera(data) {
        let requestData = await request({
            url: `${requests}/camera/delete`,
            method: "DELETE",
            data
        });
        return requestData;
    },

    // 修改监控信息
    async updateCamera(data) {
        let requestData = await request({
            url: `${requests}/camera/updateCamera`,
            method: "PUT",
            headers: { "Content-Type": "application/json; charset=utf-8" },
            data,
        });
        return requestData;
    },

    // 监控信息列表
    async queryCamera(data) {
        let requestData = await request({
            url: `${requests}/camera/queryCamera`,
            method: "POST",
            headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" },
            params: data,
        });
        return requestData;
    },
    // 导出监控信息
    async download(params) {
        let requestData = await request({
            url: `${requests}/camera/download`,
            method: "GET",
            headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" },
            responseType: "blob",
            params,
        });
        return requestData;
    },
    // 导入监控信息
    async importByExcel(data) {
        let requestData = await request({
            url: `${requests}/camera/importByExcel`,
            method: "POST",
            headers: { "Content-Type": "multipart/form-data" },
            data,
        });
        return requestData;
    },

    // 使用Stream推拉流
    async addStreamSource(data) {
        let requestData = await request({
            url: `${requests}/stream/addStreamSource`,
            method: "POST",
            headers: { "Content-Type": "application/json; charset=utf-8" },
            data,
        });
        return requestData;
    },

    // 关闭Stream推拉流
    async delStreamSource(data) {
        let requestData = await request({
            url: `${requests}/stream/delStreamSource`,
            method: "POST",
            headers: { "Content-Type": "application/json; charset=utf-8" },
            data,
        });
        return requestData;
    },
    // 更新输出链接
    async updateCameraLink(params) {
        let requestData = await request({
            url: `${requests}/camera/updateCameraLink`,
            method: "GET",
            headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" },
            params,
        });
        return requestData;
    },
    // 关闭当前播放回写剩下的播放链接、
    async delAndUpdateLink(params) {
        let requestData = await request({
            url: `${requests}/stream/delAndUpdateLink`,
            method: "GET",
            headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" },
            params,
        });
        return requestData;
    },
};
