/*
 * @Author: zc
 * @Description: ivr配置
 * @version: 
 * @Date: 2022-08-26 14:43:22
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-10 13:21:46
 */
import request from '/@/utils/request';
/**
 * @description: 获取ivr分类列表
 * @param {object} params
 * @return {*}
 */
 export const getIvrCategories = (params?: object) => {
	return request({
		url: '/api/v1/Ivr/categories',
		method: 'get',
		params: params,
	});
};
/**
 * @description: 新增ivr分类
 * @param {object} params
 * @return {*}
 */
 export const addIvrCategroies = (params: object) => {
	return request({
		url: '/api/v1/Ivr/category',
		method: 'post',
		data: params,
	});
};
/**
 * @description: 更新ivr分类
 * @param {object} params
 * @return {*}
 */
 export const updateIvrCategroies = (params: object) => {
	return request({
		url: '/api/v1/Ivr/category',
		method: 'put',
		data: params,
	});
};
/**
 * @description: 删除分类，含分类下所有IVR
 * @param {string | number} id
 * @return {*}
 */
 export const deleteIvrCategroies = (id: string | number) => {
	return request({
		url: `/api/v1/Ivr/category/${id}`,
		method: 'delete'
	});
};
/**
 * @description: 查询ivr分类，以树形结构返回IVR关系
 * @param {string} categoryId
 * @return {*}
 */
export const getIvrTree = (categoryId: string  | string[]) => {
	return request({
		url: `/api/v1/Ivr/tree/${categoryId}`,
		method: 'get'
	});
};
/**
 * @description: 查询所有ivr
 * @param {object} params
 * @return {*}
 */
 export const getIvrList = (params?: object) => {
	return request({
		url: '/api/v1/Ivr',
		method: 'get',
		data: params,
	});
};
/**
 * @description: 查询语音文件
 * @param {object} params
 * @return {*}
 */
 export const voicequerylist = (params?: object) => {
	return request({
		url: '/api/v1/Setting/voicequerylist',
		method: 'get',
		data: params,
	});
};
/**
 * @description: 页面基础信息
 * @param {object} params
 * @return {*}
 */
 export const baseInfo = (params?: object) => {
	return request({
		url: '/api/v1/Ivr/base-info',
		method: 'get',
		data: params,
	});
};
/**
 * @description: 查询ivr分类（含ivr）
 * @param {string | string[]} id
 * @return {*}
 */
 export const getIvrById = (id: string | string[]) => {
	return request({
		url: `/api/v1/Ivr/category/${id}`,
		method: 'get'
	});
};
/**
 * @description: 新增ivr配置
 * @param {object} params
 * @return {*}
 */
 export const addIvr = (params: object) => {
	return request({
		url: '/api/v1/Ivr',
		method: 'post',
		data: params,
	});
};
/**
 * @description: 更新ivr配置
 * @param {object} params
 * @return {*}
 */
 export const updateIvr = (params: object) => {
	return request({
		url: '/api/v1/Ivr',
		method: 'put',
		data: params,
	});
};
/**
 * @description: 新增或者编辑ivr关系
 * @param {object} params
 * @return {*}
 */
 export const addEditIvr = (params: object) => {
	return request({
		url: '/api/v1/Ivr/structure',
		method: 'post',
		data: params,
	});
};
/**
 * @description: 删除IVR关系（并非删除IVR）
 * @param {string} ivrId
 * @return {*}
 */
 export const delIvrTree = (ivrId: string) => {
	return request({
		url: `/api/v1/Ivr/destructure/${ivrId}`,
		method: 'put',
	});
};
/**
 * @description: 替换某个IVR分组下的起始IVR(根节点)
 * @param {string} ivrId
 * @return {*}
 */
 export const replaceRootApi = (ivrId: string) => {
	return request({
		url: `/api/v1/Ivr/replace-root/${ivrId}`,
		method: 'put',
	});
};
/**
 * @description: 删除IVR关系（并非删除IVR）
 * @param {string} ivrId
 * @return {*}
 */
 export const resetConfig = (ivrId: string) => {
	return request({
		url: `/api/v1/Ivr/destructure/${ivrId}`,
		method: 'put',
	});
};

