/*
 * @Author: zc
 * @description 威而信（电话控件api和调用威而信api）
 * @version:
 * @Date: 2022-08-09 16:19:55
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-16 14:49:01
 */
import request from '/@/utils/request';
import qs from "qs";
/**
 * @description 分机休息（wex）
 */
export const telRestAdd = (data: object) => {
    return request({
        url: `/api/v1/Pbx/rest-add`,
        method: 'post',
        data,
    });
};
/**
 * @description 分机休息wex 需要审核
 * @param {object}  params
 */
export const telRestProcess = (params?: object) => {
    return request({
        url: `/api/v1/Pbx/begin-rest`,
        method: 'get',
        params
    });
};

/**
 * @description 查询小休流程开启参数
 */
export const restFlowStart = () => {
    return request({
        url: `/api/v1/Pbx/flow-start`,
        method: 'get',
    });
};
/**
 * @description 删除分机休息
 */
export const restFlowDel= () => {
    return request({
        url: `/api/v1/Pbx/rest-del`,
        method: 'get',
    });
};
/**
 * @description 开始小休流程
 * @param {object} data
 */
export const restFlowStartWex = (data:object) => {
    return request({
        url: `/api/v1/Pbx/rest-flow`,
        method: 'post',
        data
    });
};
/**
 * @description 分机结束休息wex
 */
export const telUnrestWex = () => {
    return request({
        url: `/api/v1/Pbx/un-rest-wex`,
        method: 'get',
    });
};

/**
 * @description 威而信登录
 * @param data
 */
export const wexLogin = (data:object) => {
    return request({
        url: `/login/token`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 查询威而信所有分机
 * @param data
 */
export const getTelList = (data?:object) => {
    return request({
        url: `/api/reg/device`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 查询威而信通话记录分页
 * @param {object} data
 */
export const callLogPaged = (data:object) => {
    return request({
        url: `/api/record/list_page`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 查询威而信通话记录播放地址
 * @param {object} data
 */
export const getCallLogPlayUrl = (data:object) => {
    return request({
        url: `/api/record/playurl`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        headers:{
            'content-type': 'application/x-www-form-urlencoded'
        },
        data: qs.stringify(data),
    });
}
/**
 * @description 查询威而信黑名单分页
 * @param {object} data
 */
export const blacklistPaged = (data:object) => {
    return request({
        url: `/api/black/list_page`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信黑名单新增
 * @param {object} data
 */
export const blacklistAdd = (data:object) => {
    return request({
        url: `/api/black/add`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信黑名单删除
 * @param {object} ids
 * @param data
 */
export const blacklistRemove = (ids:string,data?:object) => {
    return request({
        url: `/api/black/delete?ids=${ids}`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 查询威而信白名单分页
 * @param {object} data
 */
export const whitelistPaged = (data:object) => {
    return request({
        url: `/api/vip/page`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信白名单新增
 * @param {object} data
 */
export const whitelistAdd = (data:object) => {
    return request({
        url: `/api/vip/add`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信白名单编辑
 * @param {object} data
 */
export const whitelistEdit= (data:object) => {
    return request({
        url: `/api/vip/edit`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信白名单删除
 * @param {object} ids
 * @param data
 */
export const whitelistRemove = (ids:string,data?:object) => {
    return request({
        url: `/api/vip/delete?ids=${ids}`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 查询威而信评价按键列表
 * @param {object} data
 */
export const satisPaged = (data:object) => {
    return request({
        url: `/api/satis/list`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信评价按键新增
 * @param {object} data
 */
export const satisAdd = (data:object) => {
    return request({
        url: `/api/satis/add`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信评价按键修改
 * @param {object} data
 */
export const satisEdit = (data:object) => {
    return request({
        url: `/api/satis/edit`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}
/**
 * @description 威而信评价按键删除
 * @param ids
 * @param {object} data
 */
export const satisRemove = (ids:string,data?:object) => {
    return request({
        url: `/api/satis/delete?ids=${ids}`,
        method: 'post',
        baseURL:import.meta.env.VITE_WEX_API_URL,
        data
    });
}