import request from '/@/utils/request';

/**
 * 分页查询学籍比对结果
 * @param query 查询参数
 */
export const fetchList = (query?: any) => {
	return request({
		url: '/basic/enrollcompare/page',
		method: 'get',
		params: query,
	});
};

/**
 * 导入全国学籍数据并比对
 * @param file 文件
 */
export const importData = (file: File) => {
	const formData = new FormData();
	formData.append('file', file);
	return request({
		url: '/basic/enrollcompare/import',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data',
		},
	});
};

/**
 * 导出异常数据
 * @param data 查询条件
 */
export const exportData = (data: any) => {
	return request({
		url: '/basic/enrollcompare/export',
		method: 'post',
		data,
		responseType: 'blob',
	});
};

/**
 * 下发至班主任复核
 * @param batchNo 批次号
 */
export const sendToClassMaster = (batchNo: string) => {
	return request({
		url: '/basic/enrollcompare/send',
		method: 'post',
		params: { batchNo },
	});
};

/**
 * 提交复核结果
 * @param id 记录ID
 * @param reviewResult 复核结果
 */
export const submitReview = (id: string, reviewResult: string) => {
	return request({
		url: '/basic/enrollcompare/review',
		method: 'post',
		params: { id, reviewResult },
	});
};

/**
 * 获取待复核统计
 * @param classMasterCode 班主任工号
 */
export const getPendingCount = (classMasterCode?: string) => {
	return request({
		url: '/basic/enrollcompare/pending-count',
		method: 'get',
		params: { classMasterCode },
	});
};

/**
 * 下载导入模板
 */
export const downloadTemplate = () => {
	return request({
		url: '/basic/enrollcompare/template',
		method: 'get',
		responseType: 'blob',
	});
};
