// import request from "@/api/request.js";
// import { ElMessage } from "element-plus";

// const request200 = requestP => {
// 	return requestP.then(data => {
// 		if (data.code === 200) {
// 			console.log('返回的数据结构 =>', data.data)
// 			return data.data;
// 		}
// 		ElMessage({
// 			message: data.message,
// 			type: "error",
// 			duration: 3 * 1000
// 		});
// 		return null;
// 	});
// };

// export function getDataCount() {
// 	return request200(
// 		request({
// 			method: "GET",
// 			// url: "/api/entitiesDataCount/countData",
// 			url: "/api/sanctionList/invFin/getTotalInfo"
// 		})
// 	);
// }

import { http } from "./service.js";

/**
 * 总次数统计
 */
export function getDataCount() {
	return http.get("/api/sanctionList/invFin/getTotalInfo");
}

/**
 * 最新出口管制政策
 * url：/sanctionList/invFin/getLatestEntityListInfo
 */
export function getLatestEntityListInfo() {
	return http.get("/api/sanctionList/invFin/getLatestEntityListInfo");
}

/**
 * 风险信号
 * url：/commonFeature/riskSignal/{moduleId}
 */
export function getRiskSignal(moduleId = "0104") {
	return http.get(`/api/commonFeature/riskSignal/${moduleId}`);
}

/**
 * 新闻资讯
 * url：/commonFeature/news/{moduleId}
 */
export function getNewsInfo(moduleId = "0104") {
	return http.get(`/api/commonFeature/news/${moduleId}`);
}

/**
 * 社交媒体信息
 * url：/commonFeature/remarks/{moduleId}
 */
export function getSocialMediaInfo(moduleId = "0104") {
	return http.get(`/api/commonFeature/remarks/${moduleId}`);
}

/**
 * 发布频度
 * url：/entitiesDataCount/getAnnualCount
 */
export function getReleaseCount(id) {
	return http.get(`/api/entitiesDataCount/getAnnualCount?sanTypeId=${id}`);
}

/**
 * 制裁领域分析
 * url：/entitiesDataCount/getSanDomainCount
 */
export function getSanDomainCount(sanTypeIds) {
	return http.get(`/api/entitiesDataCount/getSanDomainCount?sanTypeIds=${sanTypeIds}`);
}

/**
 * 制裁清单增长趋势
 * url：/entitiesDataCount/getAnnualSanDomain
 */
export function getAnnualSanDomain(params) {
	return http.post("/api/entitiesDataCount/getAnnualSanDomain", params);
}

/**
 * 全部制裁（历史制裁过程）
 * url：/entitiesDataCount/getSanctionProcess
 */
export function getSanctionProcess(sanTypeIds = "1", pageNum = 1, pageSize = 10, isCn = false) {
	return http.post("/api/entitiesDataCount/getSanctionProcess", {
		sanTypeIds,
		// typeName: tabMap[sanTypeId],
		pageNum,
		pageSize,
		isCn
	});
}

/**
 * 制裁实体领域数量变化情况
 * url：/sanctionList/statistics/domainNum
 */
export function getDomainNum(params) {
	return http.get("/api/sanctionList/statistics/domainNum", params);
}

/**
 * 获取制裁实体类型分布列表
 * url：/sanctionList/statistics/entityTypeId
 */
export function getEntityTypeCount(params) {
	return http.get("/api/sanctionList/statistics/entityTypeId", params);
}

/**
 * 新闻链接
 * url：/sanctionList/invFin/getRelateNews
 */
export function getRelateNews(sanRecordId) {
	return http.get(`/api/sanctionList/invFin/getRelateNews?sanRecordId=${sanRecordId}`);
}

/**
 * 制裁原因及相关历史制裁
 * url：/sanctionList/invFin/getReasonAndSan
 */
export function getReasonAndSan(sanRecordId) {
	return http.get(`/api/sanctionList/invFin/getReasonAndSan?sanRecordId=${sanRecordId}`);
}
