import request from '@/utils/request'

/**
 * 根据实体查询
 * @param searchStr
 * @param entClsIDs
 * @param pagenum
 * @param pagesize
 * @param isModel
 * @returns {*}
 */
//旧的entSearch函数
/* function entSearch(searchStr, entClsIDs, pagenum, pagesize, isModel, isIcon, searchType) {
    return ajax({
        method: 'get',
        url: '/ent/entquery',
        data: {
            searchStr: (searchType === 'name' || searchType == null) ? searchStr : null,
            entClsIDs,
            pagenum,
            pagesize,
            isModel,
            isIcon,
            unionID: searchType === 'id' ? searchStr : null
        }
    })
} */
//新的entSearch函数
function entSearch(searchStr, entClsIDs, pageNum, pageSize, isModel, isIcon, searchType) {
	return request({
		method: 'get',
		url: `/knowledge/entity/ent/entquery`,
		params: {
			searchStr: (searchType === 'name' || searchType == null) ? searchStr : null,
			entClsIDs,
			pageNum,
			pageSize,
			isModel,
			isIcon,
			unionID: searchType === 'id' ? searchStr : null
		}
	})
}

/**
 * 根据关系查询
 * @param searchStr
 * @param entClsIDs
 * @param pagenum
 * @param pagesize
 * @returns {*}
 */
//旧的relSearch函数
/* function relSearch(searchStr, entClsIDs, pagenum, pagesize) {
    return ajax({
        method: 'get',
        url: '/rel/relquery',
        data: {
            searchStr: searchStr,
            entClsIDs: entClsIDs,
            pagenum: pagenum,
            pagesize: pagesize
        }
    })
} */
//新的relSearch函数
function relSearch(searchStr, entClsIDs, pagenum, pagesize) {
	return request({
		method: 'get',
		url: `/rel/relquery`,
		data: {
			searchStr: searchStr,
			entClsIDs: entClsIDs,
			pagenum: pagenum,
			pagesize: pagesize
		}
	})
}

/**
 * k跳查询
 * @param entID
 * @param maxHops
 * @param pagenum
 * @param pagesize
 * @returns {*}
 */
//旧的kHopSearch函数
/* function kHopSearch(entID, maxHops, pagenum, pagesize) {
    return ajax({
        method: 'get',
        url: '/ent/khopquery',
        data: {
            entID: entID,
            maxHops: maxHops,
            pagenum: pagenum,
            pagesize: pagesize
        }
    })
} */
//新的kHopSearch函数
function kHopSearch(entID, maxHops, pagenum, pagesize) {
	return request({
		method: 'get',
		url: `/ent/khopquery`,
		data: {
			entID: entID,
			maxHops: maxHops,
			pagenum: pagenum,
			pagesize: pagesize
		}
	})
}

/**
 * 标签查询
 * @param tagName
 * @returns {*}
 */
//旧的getTag函数
/* function getTag(tagName) {
    return ajax({
        method: 'get',
        url: '/tag/searchtagname',
        data: {
            tagName: tagName
        }
    })
} */
//新的getTag函数
function getTag(tagName) {
	return request({
		method: 'get',
		url: `/tag/searchtagname`,
		data: {
			tagName: tagName
		}
	})
}

/**
 * 测试目标查询
 * @param entName
 * @returns {*}
 */
//旧的testTargetQuery函数
/* function testTargetQuery(entName) {
    return ajax({
        method: 'get',
        url: '/activity/target/search/name',
        data: {
            entName: entName
        }
    })
} */
//新的testTargetQuery函数
function testTargetQuery(entName) {
	return request({
		method: 'get',
		url: `/activity/target/search/name`,
		data: {
			entName: entName
		}
	})
}

/**
 * 测试活动查询
 * @param targetEntId
 * @param entName
 * @returns {*}
 */
//旧的testActivityQuery函数
/* function testActivityQuery(targetEntId, entName) {
    return ajax({
        method: 'get',
        url: '/activity/search/name',
        data: {
            entName: entName,
            targetEntId: targetEntId
        }
    })
} */
//新的testActivityQuery函数
function testActivityQuery(targetEntId, entName) {
	return request({
		method: 'get',
		url: `/activity/search/name`,
		data: {
			entName: entName,
			targetEntId: targetEntId
		}
	})
}

/**
 * 测试活动表格
 * @param targetEntId
 * @param entName
 * @returns {*}
 */
//旧的activityform函数
/* function activityform(activityEntId) {
    return ajax({
        method: 'get',
        url: '/activity/ent',
        data: {
            activityEntId
        }
    })
} */
//新的activityform函数
function activityform(activityEntId) {
	return request({
		method: 'get',
		url: `/activity/ent`,
		data: {
			activityEntId
		}
	})
}

/**
 * 测试活动表格
 * @param targetEntId
 * @param Name
 * @returns {*}
 */
//旧的activityChildren函数
/* function activityChildren(activityEntId) {
    return ajax({
        method: 'get',
        url: '/activity/ent/child',
        data: {
            activityEntId
        }
    })
} */
//新的activityChildren函数
function activityChildren(activityEntId) {
	return ajax({
		method: 'get',
		url: `/activity/ent/child`,
		data: {
			activityEntId
		}
	})
}

/**
 * 测试主体
 * @param targetEntId
 * @returns {*}
 */
//旧的subjectInterface函数
/* function subjectInterface(targetEntId) {
    return ajax({
        method: 'get',
        url: '/activity/main',
        data: {
            targetEntId
        }
    })
} */
//新的subjectInterface函数
function subjectInterface(targetEntId) {
	return request({
		method: 'get',
		url: `/activity/main`,
		data: {
			targetEntId
		}
	})
}

/**
 * 标签查询列表
 * @param labels
 * @param pagenum
 * @param pagesize
 * @param tagIDs
 * @returns {*}
 */
//旧的getTagentList函数
/* function getTagentList(labels, pagenum, pagesize, tagIDs) {
    return ajax({
        method: 'get',
        url: '/tag/tagentlist',
        data: {
            labels: labels,
            pagenum: pagenum,
            pagesize: pagesize,
            tagIDs: tagIDs
        }
    })
} */
//新的getTagentList函数
function getTagentList(labels, pagenum, pagesize, tagIDs) {
	return request({
		method: 'get',
		url: `/tag/tagentlist`,
		data: {
			labels: labels,
			pagenum: pagenum,
			pagesize: pagesize,
			tagIDs: tagIDs
		}
	})
}

/**
 * 初始化后台方案生成接口
 * @returns {*}
 */
//旧的initTestTarget函数
/* function initTestTarget() {
    return ajax({
        method: 'get',
        url: '/activity/init/cls/id'
    })
} */
//新的initTestTarget函数
function initTestTarget() {
	return request({
		method: 'get',
		url: `/activity/init/cls/id`
	})
}

/**
 * 下载方案生成json接口
 * @returns {*}
 */
//旧的downloadTargetJson函数
/* function downloadTargetJson(id) {
    return ajax({
        method: 'get',
        path: {
            id: id
        },
        url: '/activity/json/download/{id}'
    })
} */
//新的downloadTargetJson函数
function downloadTargetJson(id) {
	return request({
		method: 'get',
		params: {
			id: id
		},
		url: `/activity/json/download/${id}`
	})
}

/**
 * 上传方案接口
 * @returns {*}
 */
//旧的uploadButton函数
/* function uploadButton(file) {
    return ajax({
        method: 'post',
        path: {
            file: file
        },
        url: '/activity/file/import'
    })
} */
//新的uploadButton函数
function uploadButton(file) {
	return request({
		method: 'post',
		params: {
			file: file
		},
		url: `/activity/file/import`
	})
}

export {
	entSearch,
	relSearch,
	kHopSearch,
	getTag,
	getTagentList,
	testTargetQuery,
	testActivityQuery,
	activityform,
	activityChildren,
	subjectInterface,
	initTestTarget,
	downloadTargetJson,
	uploadButton
}
